I am trying to limit the “previous” and “next post” links after the content on my single posts pages to the same taxonomy as the post itself, i.e., preferably by category. I have found some helpful WP articles:
@jmott310: Sorry I don’t understand your question what do you mean by limit Previous & Next Post Links to Articles in Same Category. In single post it is controlled through catcheverest_content_nav( 'nav-below' ); function called in sinple.php file and you will find that function in template-tags.php file.
Note: please don’t edit any core theme files inside catch-everest-pro theme directly. As these files will be reverted back when you update the theme. So, if you want to edit these files and functions then you need to build Child Theme and do your edits.
Sorry, I wasn’t clear. I have my blog divided into categories. When someone views a single post the nav links you mention show links to the “previous” and “next” posts regardless of the category each post is in. So, for example, if I am viewing a post in category “B” the “previous” and “next” post links may point to articles in categories “A” and “C” depending on when each particular post was published. However, I am trying to force those nav links to only point to the “previous” and “next” posts that have the same taxonomy (i.e., category) as the post being viewed. So if I am viewing a single post in category “B” I would like the “previous” and “next” post links to only point to the “previous” and “next” posts that are also in category “B” and ignore the posts in categories “A” and “C.” The links I posted above show how to do this with a php code/argument that is different from the code found in the single.php for this theme. Sorry I didn’t post a link to my site. It is not quite live yet. If you send me an email I will set up an admin account for you to take a look at what I am talking about. Thanks for the great support and a great theme!
Thanks Sakin! Great support!!! Using your advice and the parameters in the WP Codex found in the links in my earlier post I resolved the issue by adding the following code to the functions.php file in my child theme:
The topic ‘Limit Previous & Next Post Links to Articles in Same Category’ is closed to new replies.
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.