Automatic Next/Previous Pages
-
Hi,
I’m wondering if there is a plugin that will automatically create and update Next/Previous buttons at the bottom of a page that sorts by Category.Towards the bottom of the post in the link I added, you can see the Previous/TOC/Next buttons and these buttons are currently manually added. Is there something that will automatically add them and sort by category?
I want something similar to the “Next post/previous post” button that wordpress automatically generates but specific to certain categories.
For example, every time I post something in the category “The Interstellar Male God” the button will update to the next post and only to posts in that category.
The reason I need this is because I post stories by chapters. I want to update two different stories, but want the buttons to only connect to the chapters in its own story.
Thanks in advance!
-
This topic was modified 4 years, 10 months ago by
Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
The page I need help with: [log in to see the link]
-
This topic was modified 4 years, 10 months ago by
-
The function get_the_post_navigation() has an
in_same_termargument which makes this possible.In your theme (Astra), there’s a filter hook for the navigation arguments called
astra_single_post_navigation. So this code hooks onto that and updates it to the behavior you want.You can place this in your functions.php file or use the Code Snippets Plugin.
add_filter('astra_single_post_navigation', 'wpsf_category_pagination'); function wpsf_category_pagination($args) { $args['in_same_term'] = true; return $args; }That’s exactly what I’m looking for. Thank you!
The topic ‘Automatic Next/Previous Pages’ is closed to new replies.