• Resolved suddensway

    (@suddensway)


    Hi, wondered if anyone could help…

    I have just about completed building a site at https://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
    Kevin

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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>

    to:

    <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>
    Thread Starter suddensway

    (@suddensway)

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

    Glad I could help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Next and previous posts in different categories’ is closed to new replies.