posts_nav_link() add the in_same_cat parameter

  1. Walker


    I want to be able to provide links to the previos and next post from THE SAME category while the user is viewing an individual post, but I can only do that with the previous_post_link() and next_post_link() functions, because only they support the checking parameter called in_same_cat.

    I am ok to use those two functions, but they do not have the functionality I need - the sep parameter which serves to display text between the two links.

    Here's what I currently use:

    <?php previous_post_link('%link', '&laquo; Watch Previous ' . $category_name . ' Episode', TRUE); ?> ---
    <?php next_post_link('%link', 'Watch Next ' . $category_name . ' Episode &raquo;', TRUE); ?>

    So I am using "---" as text between the two links, but when there is no next or previous post in the category, the displayed text is like this:
    « Watch Previous Weeds Episode ---, thus - the unneded triple dash.

    Posted: 8 years ago #
  2. Mark


    Now there's something that would just make plain sense. Very important, and there are only kludgy solutions to get at this currently.

    Posted: 8 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    10 Votes
  • Status

    This idea is under consideration