Forums

Next & Previous Posts - Buttons Not Showing (13 posts)

  1. cesarcesar2
    Member
    Posted 3 years ago #

    On my home page I show 10 posts out of 40. My problem is that the next and previous buttons are not showing below the last post. This is the same for when i view posts by category.

    The code i have is

    <div class="navigation">
    	<div class="alignleft"><?php previous_post(); ?></div>
    	<div class="alignright"><?php next_post(); ?></div>
    </div>

    I have also tried

    <div class="navigation">
            <div class="alignleft"><?php next_posts_link('&laquo; Previous Posts') ?></div>
    	<div class="alignright"><?php previous_posts_link('Next Posts &raquo;') ?></div>
    </div>

    I did read somewhere that this may be a permalink issue. My set up is
    /%category%/%postname%/

    Anyone have any ideas, suggestions, plugins?

    Thanks.

  2. cesarcesar2
    Member
    Posted 3 years ago #

    bump

  3. thisisedie
    Member
    Posted 3 years ago #

    Since you didn't give a URL I can't look to see if this is what your problem is also, but you might try the fix here:

    http://wordpress.org/support/topic/203417?replies=8

  4. cesarcesar2
    Member
    Posted 3 years ago #

  5. thisisedie
    Member
    Posted 3 years ago #

    So... did the fix at that link work for you?

  6. cesarcesar2
    Member
    Posted 3 years ago #

    http://wordpress.org/support/topic/203417?replies=8

    My css is correct as stated in the link and still not working.

  7. thisisedie
    Member
    Posted 3 years ago #

    Are you sure you dont have it set for more than 10 posts on the front page? Because in your source code is:

    <div class="navigation">
    <div class="alignleft"></div>
    <div class="alignright"></div>
    </div>

    which means that the correct code is there, but there aren't enough posts showing to make the previous and next links appear.

  8. thisisedie
    Member
    Posted 3 years ago #

    Got any plugins running that set the number of posts per page?

  9. cesarcesar2
    Member
    Posted 3 years ago #

    Admin says

    Blog pages show at most (10)

    I have no plugins that modify this that i know of.

  10. iridiax
    Member
    Posted 3 years ago #

    Use posts_nav_link on index, category and archive pages:

    <?php posts_nav_link(); ?>

    Here's info on how to customize its display:

    http://codex.wordpress.org/Template_Tags/posts_nav_link

    Also, read example 3 here if you are using query_posts.

  11. cesarcesar2
    Member
    Posted 3 years ago #

    how to i know if im using

    query_posts

    So far using

    <?php posts_nav_link(); ?>
    is not working. I have tried this before with failure.

  12. cesarcesar2
    Member
    Posted 3 years ago #

    I found this line

    if (have_posts()) : while (have_posts()) : the_post();
    then added above it
    query_posts($query_string.'&posts_per_page=-1');
    and nothing changed.

  13. willdawson
    Member
    Posted 3 years ago #

    Hi,

    As per the codex http://codex.wordpress.org/Template_Tags/previous_post_link you have to put <?php previous_post_link() ?> instead of <?php previous_posts_link() ?> if you want to display only the one post. However, I use this

    <?php $postslist = get_posts('numberposts=1&offset=1'); foreach ($postslist as $post) : setup_postdata($post); ?>
     								</div>

    Then used this
    <a href="<?php the_permalink() ?>Here is an image</a>

Topic Closed

This topic has been closed to new replies.

About this Topic