0

I have the following custom pagination for my galleries.

http://pastebin.com/MnypvU6P

Now when I open my galleries, I can press next and previous and it works but it loops through posts in all categories, how can I limit it to categories?

For example if I have a category called "Weddings" I want the next and previous to show only galleries in that category.

  • Please put the code in the question. – Nicolai Dec 7 '16 at 15:35
  • @ialocin the code is in the pastebin link – Radu033 Dec 7 '16 at 15:45
  • You can't expect people to follow links to see your code, so it is better to put directly into the question, after all you want to make it easy for the people helping you. – Nicolai Dec 7 '16 at 16:59
  • @ialocin I added in pastebin because it's too long for stackoverflow + everyone knows about pastebin – Radu033 Dec 7 '16 at 17:16
  • Your decision, I was just trying to help you. – Nicolai Dec 7 '16 at 22:34
0

The functions next_post_link() and previous_post_link() have the parameters $in_same_term and $taxonomy for that purpose.

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.