Skip Navigation

[Resolved] Check taxonomy values of prev/next post in single post

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by tomasP 4 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1379285

hello,
I have a custom post type with several custom taxonomies. In a single post content template I am trying to create links to prev/next posts but only for posts with certain taxonomy values. Is there a way to achieve this?

Tell us what you are trying to do?
E.g.
1) I have a custom taxonomy "portfolio" which includes e.g. "photo" value. Then I have another custom taxonomy e.g. "homepage" with e.g. "hp-yes" value.
2) Let's say current post has "photo" value in "portfolio" taxomony and value "hp-yes" in "homepage" taxonomy attached.
3) I need the prev/next links to link only to previous and next posts with the "photo" and "hp-no" taxonomy values attached.

Is there any documentation that you are following?
- Didn't find any covering this particular problem

What is the link to your site?
hidden link

Thanks very much in advance
Tom

#1379579

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I understand what you are looking for and you want to filter your prev and next single post pagination links with the specific terms of the current post.

There is no such feature available with Toolset but I've a workaround to offer you using which you can implement such custom requirement.

You can achieve this by using the get_next_post_where and get_previous_post_where native WordPress hooks to filter the prev-next post link on single post.

Please check the following related links that will be helpful to implement your needs;
=> https://stackoverflow.com/questions/42704120/get-next-post-with-custom-taxonomy-term
=> hidden link
=> https://stackoverflow.com/questions/42704120/get-next-post-with-custom-taxonomy-term

You can make changes to the script where required.

#1379885

Thank youuuuuu!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.