• I’ve just set up two blog categories on my site and notice that the next and previous entries link links back to the first blog page. What do I need to change in the tag to make it take you back or forward?

    The current tag in the .php file:

    <div class=”alignleft”><?php next_posts_link(‘« Previous Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Next Entries »’) ?></div>

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Its the query_posts code that needs to be changed

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
          query_posts("cat=1&amp;paged=$paged"); ?>

    instead of “cat=1”, paste in whatever you have now as your query_posts parameters.

    Thread Starter riis

    (@riis)

    I can’t find that code in the .php file. Where’s it supposed to be?

    Hi

    I’ve just set up two blog categories on my site and notice that the next and previous entries link links back to the first blog page.

    How did you do that? Did you just create two categories so both appear on one page, or did you add code so each appears on its own page?

    I made the assumption you had added a query_posts statement to your code. My post was about modifying that. If that’s not what you did my solution doesn’t apply, although the problem you are having IS related to WP’s paging code.

    If you did add a query_posts, then post here the exact code you added, and also which template file(s) you added it to.

    Thread Starter riis

    (@riis)

    I modified the single.php file with the following code and created two new.php files for each blog category, like pages.

    <?php
    $post = $wp_query->post;
    if ( in_category(‘1’) ) {
    include(TEMPLATEPATH . ‘/davidsgearblog.php’);

    } else {
    include(TEMPLATEPATH . ‘/mygearblog.php’);
    }
    ?>

    Please see my site https://www.gilmourish.com. At the bottom of the front page blog, the “previous entries” link just links to the top of the page or back to the front page blog.

    Makes me think that I perhaps need to add a tag referring to the archive for each blog?

    The second blog is here https://www.gilmourish.com/?page_id=297

    Thanks for your help!

    Thread Starter riis

    (@riis)

    Please, does anyone have a clue what might be the problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“next entries” link broken’ is closed to new replies.