Support » How-To and Troubleshooting » Postionation? Previous & Next for parent Category or Subcategory

Postionation? Previous & Next for parent Category or Subcategory

  • I am using permalinks: /%category%/%postname%/

    Is there any easy way (or code) to have a categorybased Postination (<Previous and Next> link or title).

    I want that the code asks if the postination(pagination) works within the category or if existing the subcategory.

    To I made myself clear?


Viewing 6 replies - 1 through 6 (of 6 total)
  • Victor Petrescu


    Here is the syntax for the previous_post_link function:

    <?php previous_post_link($format, $link, $in_same_cat = false, $excluded_categories = ”); ?>

    Here is a working example for what you need:
    <?php previous_post_link(‘%link’, ‘Previous in category’, TRUE); ?>

    More details here:

    Victor Petrescu


    And of course the next_post_link function:

    Same problem here, i used the guidelines on that thread Victor, but the problem is that the next and previous button acts for the top category not the subcategory, im my case i have like:


    when i’m in the first sofa post i shouldn’t have a previous button, but i have and it goes to last post off chairs subcategory, because is navigating in the main category furniture not the current category of the post.

    Any ideas?

    Hey just found what was my problem, some posts add the main category and the subcategory marked, that’s why.


    And how to you get rid of it?

    In my case deftru, i have a ecommerce style website and i had most of the produts with two categories (main and sub) so the buttons will continue to show until the main category reaches the end, so i just need to deselect the main category from every product so that the buttons only read the subcategory.


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Postionation? Previous & Next for parent Category or Subcategory’ is closed to new replies.