In
single.php, after
content code
get_template_part( 'template-parts/post/content', get_post_format() ); // content code
there is the code for post navigation (means links to move between this and that posts)
the_post_navigation(
array(
'prev_text' => '...' . '...',
'next_text' => '...' . '...',
)
);
it shows two links for the previous post and next one of the current post at the bottom of the screen,
however, the problem is when you click/tab the links again and gain, you find the links include
any posts from all different categories, just in order of their written date and time.
Here is the way to move among only one category, even though you keep clicking/tabbing the prev/next links.
the_post_navigation(
array(
'prev_text' => '...' . '...',
'next_text' => '...' . '...',
'in_same_term' => true,
'taxonomy' => 'category',
)
);
Yup, adding that two lines are all.
Happy wordpressing!