Support » Fixing WordPress » Postionation? Previous & Next for parent Category or Subcategory

  • deftru

    (@deftru)


    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?

    Thanks

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

    (@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:
    http://codex.wordpress.org/Template_Tags/previous_post_link

    Victor Petrescu

    (@victor-petrescu)

    And of course the next_post_link function:
    http://codex.wordpress.org/Template_Tags/next_post_link

    rvlt

    (@rvlt)

    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:

    furniture
    -chairs
    -sofas

    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?

    rvlt

    (@rvlt)

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

    regards

    deftru

    (@deftru)

    And how to you get rid of it?

    rvlt

    (@rvlt)

    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.

    regards

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