Support » Fixing WordPress » Codium "Nex page" doesn't work

  • Resolved petersandeen

    (@petersandeen)


    Hi,

    I don’t know if it’s my fault, but the “Next page” link on the index page doesn’t work. It links to this page: http://myhappierlife.com/page/2/ but this page is identical to the first page. I’ve done some alterations to the code, but I have no clue to what might be the problem.

    My website is: http://myhappierlife.com/
    I’m using the latest version of both the theme and WordPress.

    Any help would be much appreciated!

    Sincerely,
    Peter

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi

    (@esmi)

    Forum Moderator

    Have you tried:

    – deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the Twenty Eleven theme to rule out any theme-specific problems.

    resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    Hi,

    thank you for your reply. Switching to another theme (Twenty Eleven) resolves the problem. I tried deactivating the plugins and even deleted all unused ones, but it didn’t help. I also did the resetting of the plugins folder, but it didn’t help either. So, it seems to be a theme issue.

    Is there something else I could try?

    Here’s the code from the index page that creates the “Next page” button.

    <?php if(function_exists('wp_pagenavi')) {
    		wp_pagenavi();
    	} else {?>
    		<div class="navigation mobileoff"><p><?php posts_nav_link(); ?></p></div>
    		 <?php } ?>
    		<div class="navigation_mobile"><p><?php posts_nav_link(); ?></p></div>

    I also tried the “WP-PageNavi” plugin, but the same result. http://myhappierlife.com/page/2/ is still identical to the first page (meaning it shows the most recent posts instead of going to older posts.

    Any advice is appreciated!

    Sincerely,
    Peter

    You might want to try to add this before your loop. Of course, you might want to edit to number of posts to show and maybe the category (cat=catid).

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('posts_per_page=10'.'&paged=' . $paged);

    Hope it works.

    Thank you for replying.

    I want to make sure I understood correctly. Am I supposed to add “<?php” before the code (and “?>” after it)? If I don’t it just shows up as text in the page. And also did you mean it needs to be put right before these lines?

    <?php query_posts("cat=-1"); ?>
    			<?php if (have_posts()) : ?>
    			<?php while (have_posts()) : the_post(); ?>

    The code you wrote does affect the number of posts per page, but didn’t solve my original problem. Or did I just implement it incorrectly? You mentioned the catid. Did you mean the first line in my loop code?

    I tried removing the first line of the code above (<?php query_posts(“cat=-1”); ?>) but it had no effect. I tried moving your code around the loop code and inside of it, but to no effect (though putting it after the loop code made the index page show the latest post indefinite times).

    Advice is still much appreciated!

    Sincerely,
    Peter

    Your right about the php-tags needed in front of/after the code.

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=-1&posts_per_page=10'.'&paged=' . $paged);?>
    			<?php if (have_posts()) : ?>
    			<?php while (have_posts()) : the_post(); ?>

    This would be the code you need to use.

    Hi jeffreyvr!

    Thank you so much. The code worked. I didn’t know how to “combine” the old code into the new one and therefor implemented it incorrectly.

    Sincerely,
    Peter

    PS. It’s wonderful to see there are so many people willing to help others here.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Codium "Nex page" doesn't work’ is closed to new replies.