WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Older/Newer Posts not displaying (2 posts)

  1. flint_and_tinder
    Member
    Posted 3 years ago #

    Hi all,

    Can anyone help with this problem.

    I have a WP site built here:
    http://www.thetinderboxblog.com/kha

    I have an issue that the older/newer posts buttons aren't displaying the next images in the database. It just keeps showing the first 5 posts regardless of which page you are on.

    For example,
    http://www.thetinderboxblog.com/kha/animals/page/2
    displays the same as
    http://www.thetinderboxblog.com/kha/animals

    I have added some code to the functions.php that makes sure those buttons are displayed only when their are other posts in that category archive. However regardless of whether I remove that or not, the issue still persists. This is the code I have used for that:

    <?php
    /**
     * If more than one page exists, return TRUE.
     */
    function show_posts_nav() {
    	global $wp_query;
    	return ($wp_query->max_num_pages > 1);
    }
    ?>

    Each drawing/painting category uses roughly the same code to display the posts. For the process of this question here is the code for the Animal page:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Can anyone see where I'm going wrong here and help me out? I'd greatly appreciate it.
    Link to the page the code above references is, once again, this:
    http://www.thetinderboxblog.com/kha

    Adam.

  2. flint_and_tinder
    Member
    Posted 3 years ago #

    I appear to have fixed it by changing this:

    <?php query_posts('cat=5s&showposts=5'); ?>

    to this:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($y_string.'&cat=5&paged=' . $paged); ?>

    Can anyone see any problems in this?

Topic Closed

This topic has been closed to new replies.

About this Topic