WordPress.org

Ready to get started?Download WordPress

Forums

How to notify reader of additional posts? (5 posts)

  1. deko
    Member
    Posted 8 years ago #

    In the admin pages - Options > Reading, I like to set "blog pages" section to show at most 5 posts to keep a handle on page size.

    But what if I have 12 posts? How does the reader know there is more scintillating reading just around the corner?

    Is there some way I can display a link, perhaps in the footer, that says More Posts >> or something like that?

    Perhpas even 7 More Posts >> where the number would be calculated based on how many posts are currently displayed on the first page?

    Other options?

  2. moshu
    Member
    Posted 8 years ago #

    By default most themes have the Next/Prev link at the bottom which will be displayed as soon as the number of your posts is bigger than the # set in Options.

    To display that kind of 175 post thing... you'll need a plugin.
    http://codex.wordpress.org/Plugins

  3. deko
    Member
    Posted 8 years ago #

    I think I've seen that bit of code in there somewhere. But doesn't that just go to the next post, as opposed to filling the page with the next/previous 5 posts?

    That's the behavior I'm looking for: where the user can page through x number posts at a time - where x is the number set in Options.

    Getting the 'display posts' number from options and the total number of posts in the category is easy enough - but how to keep track of where you are? Do I need view state for this? How will my code know whether posts 5 thru 10 or posts 11 thru 16 are currently displayed in the page?

  4. Chris_K
    Member
    Posted 8 years ago #

    ...But doesn't that just go to the next post, as opposed to filling the page with the next/previous 5 posts?

    Depends on which tag you're using of course.

    Great info here: http://codex.wordpress.org/Template_Tags

    In my theme, at the bottom of index.php, I use next_posts_link() and prev_posts_link() (which, after a glance at the codex, both appear to be deprecated now. doh). http://codex.wordpress.org/Template_Tags/posts_nav_link is similar for paged navigation.

    A single.php might use next_post() and previous_post() instead.

  5. deko
    Member
    Posted 8 years ago #

    <?php get_posts('arguments'); ?> has an offset argument, and query_posts looks interesting.

    But I'm unsure if I can get the behavior I'm looking for without some kind of page state mechanism.

    I can envision a way to select some number of posts, but I will need to know whether posts 5 thru 10 or posts 11 thru 16 are currently displayed in the page... this info must be maintained in some page/session variable, no?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags