I need a way to display next/previous post links which only show posts which share a specific taxonomy term.
I have a portfolio site I'm building which has a taxonomy called "expertise". Under that taxonomy, there are several terms such as "branding", "packaging", etc. A project in the portfolio can have more than one taxonomy term applied to it. For example, a project could be a branding, identity, and packaging project.
I've created a custom post type for projects in the portfolio and have built a template for displaying individual projects. I would like to be able to have next/previous post links only show posts which share a specific taxonomy term. I can pass this term from the querystring (i.e. http://mysite.com/myproject/?expertise=branding) but don't know how to restrict the next/previous links to that specific term. The fact that a project can share several terms makes this difficult.
I've tried the following plugins but they can't seem to restrict the next/prev links to ONE term. Instead, they will include other projects which share any of the terms for the current project.
Previous and Next Post in Same Taxonomy:
Next/Previous Post Link Plus for WordPress:
I'm discussing my issue with each of the plugin authors so it may be that one of these will do what I'm hoping for and I'm just not understanding. I'll update this thread if this is the case.
In the meantime, if anyone has a solution for me, I would appreciate it. I'm guessing this may be able to be done with a custom query but my SQL chops aren't quite up to it.
Thanks for any help you can offer.