• I’m really new to working with the PHP code in WordPress. Is anyone able to explain to me why the “Older” button on my blog just loops right back to the same page? The URL shows it’s going to page 2, 3, 4, etc, but it appears the same as the first page. Here’s my code:

    <?php if (get_option('paging_mode') == 'default') : ?>
        <div class="pagination">
            <?php previous_posts_link(__('Newer')); ?>
            <?php next_posts_link(__('Older')); ?>
            <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); ?>
        </div>
        <?php else : ?>
        <div id="pagination"><?php next_posts_link(__('LOAD MORE')); ?></div>
    <?php endif; ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • Um – why do you have multiple sets of pagination links?

    Thread Starter pabadi

    (@pabadi)

    You’re going to have to talk about this to me like I’m 10 years old, I honestly have not done any of this before.

    <?php previous_posts_link(__('Newer')); ?>
    <?php next_posts_link(__('Older')); ?>

    is one set of pagination links. Then there’s a second set:

    <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); ?>

    and finally, you have an alternate set based on <?php if (get_option('paging_mode') == 'default') : ?>

    </div>
    <?php else : ?>
    <div id="pagination"><?php next_posts_link(__('LOAD MORE')); ?></div>

    What theme are you using? Where did you download it from? Has it been modified?

    Thread Starter pabadi

    (@pabadi)

    Oooh, I see. I’m working with the Sight-working theme. Not sure where it was downloaded or if it’s been modified (my guess is yes), I’m picking this project up from someone else. I’m going to try to see if removing one of the sets does anything (I have the original code copied into Notepad so I’m not worried about messing the entire thing up).

    Thread Starter pabadi

    (@pabadi)

    I changed it to just

    <div class="pagination">
            <?php previous_posts_link(__('Newer')); ?>
            <?php next_posts_link(__('Older')); ?>
    
        </div>

    But it’s still doing the thing where I click “older” and it changes the url to index.php/page/2/ but displays the first page.

    Sight is not a theme we support here. Apart from the replicated pagination links, it’s also possible that there are issues further up the template file.

    Thread Starter pabadi

    (@pabadi)

    Ok. Thanks anyway for helping out.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘"Older" posts link looping to first page’ is closed to new replies.