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.

5
  • Please put the code in the question. Dec 7, 2016 at 15:35
  • @ialocin the code is in the pastebin link
    – loliki
    Dec 7, 2016 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. Dec 7, 2016 at 16:59
  • @ialocin I added in pastebin because it's too long for stackoverflow + everyone knows about pastebin
    – loliki
    Dec 7, 2016 at 17:16
  • Your decision, I was just trying to help you. Dec 7, 2016 at 22:34

1 Answer 1

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 and acknowledge you have read our privacy policy.

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