0

I'm a beginner of wordpress ... I'm creating my first template and I would like to exclude the category "portfolio" from pagination. I tried in every way, but I managed to do just the opposite, browse through posts in the same category.

Do you have any suggestions? thank you so much

this is the code. I want to browse all posts, except posts with "portfolio" category.

<div class="row pagination pt-5">
  <div class="col-5 no-gutter">
      <p class="text-left "><?php previous_post_link(); ?></p>
  </div>
  <div class="col-5 no-gutter">
      <p class="text-right"><?php next_post_link(); ?></p>
  </div>
</div>
  • What exactly do you mean by „excluding from pagination”? Do you want to exclude posts from this category, so they won’t appear on index? – Krzysiek Dróżdż Apr 17 '18 at 6:42
  • I want that in the pagination of single.php the posts of the portfolio category never appear. I want to browse all posts except those in the portfolio category. – Nicola Apr 17 '18 at 6:53
  • But single.php displays only one post. What “pagination” are we talking about then? Do you mean prev/next post link? – Krzysiek Dróżdż Apr 17 '18 at 6:55
  • Yes exactly the prev/next post link. Sorry for my English.. – Nicola Apr 17 '18 at 6:59
  • Please edit your question to add in the code that isn't working. This might help us figure out where the problem is. – Pat J Apr 17 '18 at 14:08
0

Change Query Vars ( filter parse_query ) - using Taxonomy Query or post__not_in if you going preselect posts from category and put them to cache so you can skip db calls sometimes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.