• I am trying to let the reader select a category and when on the single post page, the next/previous pagination will be restricted to the selected category.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Bunty

    (@bhargavbhandari90)

    <?php previous_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ); ?>

    Try this if this could help you.

    Thread Starter dillscallion

    (@dillscallion)

    Thanks. I’m new to creating custom .php and templates. Do I need to make one of these for each category?

    Moderator bcworkz

    (@bcworkz)

    The same template is typically used for all single posts (theme dependent, often single.php). Use Bunty’s code to replace whatever navigation code currently exists on the template.

    If you don’t want to have your code overwritten every time the theme is updated, create a child theme and copy the template file to the child before editing it.

    Thread Starter dillscallion

    (@dillscallion)

    Oh, I understand. The problem is that I need to keep the original code intact and let the reader choose the category. I have several categories for the reader to choose from, but when a single post from that category is viewed, the Next/Prev buttons default to the original criteria.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Single post navigation within selected category’ is closed to new replies.