• Hi,
    I manage 2 categories.

    I have a problem in single post page with the pagination : the links Next / Previous posts show all posts, without filtered in the category.

    I shall wish that the pagination show only the posts of each category.

    Could you please tell me how I can do it ?
    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • sacredpath

    (@sacredpath)

    Automattic Happiness Engineer

    Hi there, this would require a Child Theme and then copying over some of the existing php files from the original theme and modifying them, including writing a new the_posts_navigation function. Alternately, you might be able to create a brand new page template, or page templates for those two categories with the new post navigation php within it.

    Thread Starter makai93

    (@makai93)

    Hi,
    The link for next and previous post is in single.php :

    <div class="navigation">
    	<div class="previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'max-magazine' ) . '</span> %title', TRUE ; ?></div>
    	<div class="next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'max-magazine' ) . '</span>', TRUE ); ?></div>
    </div><!-- #navigation -->

    I see the value TRUE for the parameter $in_same_term (WordPress codex – Reference – Functions – previous_post_link()), but it doesn’t work.
    All the posts are shown whatever the category…

    So, why doesn’t it run as expected ? Do you have an idea ?
    Thank you

    • This reply was modified 6 years, 6 months ago by makai93.
    sacredpath

    (@sacredpath)

    Automattic Happiness Engineer

    Hmmm, this may be a bit of a quagmire. If you change those, then if you go to a single post off of the blog, or a tag, or date archive page, the previous and next buttons at the bottom of a single post will go to the next post of that category. This can probably be done with some complex php if-then-else stuff, and would probably require setting of some variables to keep track of what type of archive page the single post was reached from.

    Given this is likely to be quite complex, I would suggest posting at https://jobs.wordpress.net/ and see if someone could do that, and what it would cost.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination in single post page (category)’ is closed to new replies.