Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to find out if it is possible to pass certain parameters to next_post_link() and previous_post_link() to make it only show other custom posts that have the same custom taxonomy values choosen?

In my case i have a custom post type named "houses" and two custom taxonomies called "num_floors" and "collection"

If a user is on a single house page i want next/prev links only to other houses with the same value for num_floors and collection as the one currently viewed..

Appreciate your help!

share|improve this question
add comment

2 Answers

There is no parameter for taxonomy in that function. But you can use them to look for posts in the same 'category', i.e. they are hardcoded to work with only 'category'

You might want to use this plugin http://wordpress.org/extend/plugins/previous-and-next-post-in-same-taxonomy/

share|improve this answer
    
Thank you, will have a look at this. –  jonas Oct 26 '12 at 7:35
add comment

I ended up doing a custom function in functions.php where i queried all the posts according to the needs and then looped trough them and compared the position to the current post id, returning links.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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