Pagination

I'd like to add pagination under the "Latest News Posts" on my front page, so that people can get to my older posts from there. I have installed WP-Paginate plugin and added the code to the home.php file to display the pagination. It does display, but it doesn't actually work (clicking on it gets me nowhere). Am I adding the code to the wrong place? Where is the proper place to insert the code so that pagination for posts works? Thank you.

  • aecnu

    Greetings hkim135,

    Thank you for the great question in which it can be pretty challenging to support other peoples work, but we do our best here to help.

    After looking up WP Pagination to see what we are dealing with there on your installation, it immediately caught my attention to how old it is and that the claimed supported version of WordPress is also way behind.

    Though often the older plugins still work as anticipated, in many cases more often then not they do not work any longer, but this is relative to the nature of the job the plugin is supposed to do.

    With all the plugins available to perform this job, I have no idea why you picked this one when others like TW Pagination plugin and others are a lot newer and have a much higher review rating.

    Therefore the only options we have at this moment are to either contact the author of the plugin and ask them whats up with it and this issue or to more wisely choose a more current and higher rating plugin.

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • hkim135

    Hi,

    I need to clarify my question. I'm not committed to any particular pagination plug-in. I've tried several.

    My real problem, I believe, is that I don't know where in the theme to put in the line (for example): <?php if(function_exists('tw_pagination'))
    tw_pagination();
    ?>
    to allow pagination of my "Latest Posts" on my front page.

    The directions usually say to look in the loop.php file and replace to replace previous_posts_link() and next_posts_link() code block with the code above, but I can't find where in the theme files they are, or if they exist in this theme. Thank you.

  • hkim135

    Hi, I'm using the bp-scholar theme. I've been able to successfully add pagination to other themes (not from WPMU), so I'm thinking the issue is specific to this theme.

    I noticed that bp-scholar has a theme option which allows you to set the number of posts shown on front page, which seems to over-ride the number you set in the Wordpress admin panel. It makes me think that for the front page, there is a different posts loop or setup from the one Wordpress uses? Perhaps this is the issue?

    Anyway, once the pagination plug-in is activated and the code inserted where I want the pagination to appear, the pagination appears, but pressing on "page 2" (for example) takes me to domain/page/2, which is the same as home page, and not to the page of older posts as I desire.

    My overall goal is to allow readers to go from the newest posts on the front page to older posts. Even something as simple as a "<<<previous posts" link that goes to the right place would be fine.

    Thank you for any insight.

  • aecnu

    Greetings hkim135,

    Thank you for your additional input to include the detailed description of what the theme is and the challenges you have had trying to incorporate pagination.

    Considering it is a WPMU DEV theme, I will see if I can get the lead developer in here with his invaluable insight into this theme for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Jeffri

    Hi there,

    Sorry for the delay to get back to you.

    You are right about the home page using different loop and it doesn't support pagination by default. To add pagination, you'll need to add the page number into the homepage latest post query. To do that, you need to edit home.php and find this line 45:

    <?php query_posts('category_name='. $news_category . '&showposts='. $news_amount . ''); ?>

    Change the line above to:

    <?php
    	wp_reset_query();
    	$paged = get_query_var('paged');
    	query_posts('category_name='. $news_category . '&posts_per_page='. $news_amount . '&paged=' . $paged);
    ?>

    At this point, the page navigation will work. All that left is to add your pagination code from the plugin of your choice (or WordPress default). Add that code after the line below:

    <?php endwhile; ?>

    Which is placed on line 62 before the edits. For example:

    <?php endwhile; ?>
    <?php if(function_exists('tw_pagination')) tw_pagination(); ?>

    I'll suggest you to use child theme so you don't lose your edits in future updates.

    Hope that works for you and also let me know if you need further assistance.

    Thank you.

    Jeffri

  • aecnu

    Greetings hkim135,

    We have not heard back from you as to the status of this issue.

    If you are still having an issue please let us know so that we may try to get you fixed up as soon as possible by choosing to check mark this ticket as unresolved below and posting any new errors or symptoms you are noticing.

    This action will also bring your ticket up front back in plain view again within the ticket system.

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.