Limit post navigation to posts in the same category
-
Greetings. I created a child theme of the Elicit theme for a small business association. I then created a custom post type named “small_business” to display the member pages which uses a template I created from
single.php
. Here is an example: https://scasbog.raddaddesign.com/small_business/placeholder-business-1Each of these businesses is going to be in one or more categories. The text under the page title, “Business type: Business & Personal Services” displays the category.
I would like to limit the posts navigation under the content to only posts in the current category.
The navigation code on the single.php is different than the WordPress codex.
How do I change the code below to limit the post navigation to the current category?
<?php wp_link_pages( ); ?> <?php if ($prev_link || $next_link): ?> <div class="navigation" > <div class="singleright"> <p><?php esc_html_e('Next-> ', 'elicit'); ?><strong><?php echo $prev_link; ?></strong></p> </div> <div class="singleleft"> <p><strong><?php echo $next_link; ?></strong><?php esc_html_e(' <-Previous', 'elicit'); ?></p> </div> </div> <?php endif; ?>
Thanks
- The topic ‘Limit post navigation to posts in the same category’ is closed to new replies.