Ready to get started?Download WordPress


[resolved] Next and previous posts in different categories (4 posts)

  1. suddensway
    Posted 2 years ago #

    Hi, wondered if anyone could help...

    I have just about completed building a site at http://www.linkwellcoaching.co.uk/proofnew

    Posts are in one of two categories - 'news' and 'testimonials'. In the menu, the links are set to show the relevant category, displaying just one post at a time. The 'next' and 'back' buttons work fine. So far so good.

    However the problem arises when you view a single post (by clicking on a summary heading from the sidebar). now when you use the navigation buttons it scrolls through posts from BOTH categories, so jumping from the news page to the testimonials page and vice versa.

    Is there any way around this problem? Viewing posts via its category works perfectly but as individual posts directly the problem is there.

    I am using a Twenty Eleven child theme.

    Any help would be so welcome.

    many thanks

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    In your child theme's copy of single.php, you will need to change:

    <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span>
    <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></span>


    <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'twentyeleven' ), true ); ?></span>
    <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), true ); ?></span>
  3. suddensway
    Posted 2 years ago #

    esmi, you are a god-like genius... Thank you!

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Glad I could help :-)

Topic Closed

This topic has been closed to new replies.

About this Topic