WordPress.org

Forums

previous_posts_link next_posts_link not displayed (4 posts)

  1. AlistairChristie
    Member
    Posted 7 years ago #

    When you run a search on my blog (http://www.itauthor.com/wordpress/) you get just 5 results per page, and there's no way to get any more.

    I've read the Codex and various Forum postings and anything else I could find - all of which suggests that the way to add Older/Newer links at the bottom of the results page is by using previous_posts_link and next_posts_link.

    However, I've added these to my search.php file without any luck. I've tried the following variations:

    <div class="navigation">
     <div class="previous">
      <?php previous_posts_link('Next Entries &raquo;') ?>
     </div>
     <div class="next">
      <?php next_posts_link('&laquo; Previous Entries') ?>
     </div>
    </div>
    
    <p><?php next_posts_link('« Previous Entries /') ?> <a href="<?php echo get_settings('home'); ?>" title="return home">Home</a> <?php previous_posts_link('/ Next Entries »') ?></p>
    
    <div class="navigation">
     <div class="alignleft"><?php next_posts_link('&laquo; Previous') ?></div>
     <div class="alignright"><?php previous_posts_link('Next &raquo;') ?></div>
    </div>

    The Next/Previous links just don't appear. When I look at the source HTML I just get empty divs.

    Can anyone suggest a solution?

    What's stopping these functions producing any output?

  2. moshu
    Member
    Posted 7 years ago #

    Actually, there is no such template tag as you posted.

    You should use http://codex.wordpress.org/Template_Tags/posts_nav_link
    to display the next/prev navigation on multipost views.

  3. AlistairChristie
    Member
    Posted 7 years ago #

    Thanks moshu. I read that page and tried the following example code:

    <p>above</p>
    <div style="text-align:center;">
    <?php posts_nav_link(' · ', 'previous page', 'next page'); ?>
    </div>
    <p>below</p>

    However, this just give me the following:

    above

    below

    With the source code:

    <p>above</p>
    <div style="text-align:center;">
    </div>
    <p>below</p>

    As before, the links don't show up.
    Anyone have any idea why not? I'd really like to be able to reach more than 5 search results.

  4. Ghidra99
    Member
    Posted 7 years ago #

    Moshu, that's simply not true. Those template tags do exist (look in the archive.php under the "Kubrick" theme).

Topic Closed

This topic has been closed to new replies.

About this Topic