• at the bottom of posts there is a previous and next post. On my website (https://www.abegaeljackson.ca) I would like it to be category specific. In other words, when in the “blog” category I’d like the prev and next navigation to stay on blog posts. And when in the “artwork” category (and child categories), I want the prev and next navigation to stay in the “artwork” category.

    I feel like this is probably not that hard however I can’t seem to find the right search terms to find any useful information on Google. Does anyone here know?

Viewing 2 replies - 1 through 2 (of 2 total)
  • seems easy but cant find easy way to do this.

    check this discussion
    https://www.ads-software.com/support/topic/previousnext-post-in-category?replies=38

    Thread Starter Abbey Jackson

    (@abegael)

    laliz, thank you thank you! The support article linked to in that discussion had the answer:

    <?php next_post_link( '%link', 'Next post in category', TRUE ); ?>

    btw you can exclude categories:

    <?php next_post_link( '%link', 'Next post in category', TRUE, cat# ); ?>

    Now I’m wondering if you would happen to know how to customize the message depending on the category. I understand the logic in how to do this but I am self-taught by trial & error // cut & paste so I’m not quite sure what the code will be.

    In plain english it would be “if category _A__, then: __(code above customized for the category)__ else if category _B__ then: __(code above customized for the category)__”

    Would you happen to know how to write this?

    OR alternatively, how to have the message inside the code say “Next __categoryname__ post”

    I’ve been looking through the codex and have tried all kinds of things but nothing I have tried is working. I just want the message to specify which category the person is currently navigation. I can do that by doing the else if thing and just writing a different message for each category or by printing the category name in the message…but I can’t figure out how to do either.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Keeping prev/next navigation within current category’ is closed to new replies.