I have created a custom taxonomy called "Locations". This will be a list of cities and counties.
I am trying to figure out how I would display posts on a page that contain the same taxonomies. For example, I write a blog post about Seattle real estate and add the "Seattle" location taxonomy.
I have a page called "Seattle Homes" with the same taxonomy "Seattle". My intention is to have the page display the post with the same taxonomies.
Hi,
Welcome to Toolset support.
- Create a view on the page and select the post type that the custom taxonomy is created on.
- On the sidebar option you will see a section called query filter. Select that and from the list select the Taxonomy term option. For you it will be Location
- Then you will be presented either with the Seatle option or you can manually type it for the query and it will perform the result. (Screenshots are from my installation, so the name of the term is related to my case)
Thanks
Thanks Christopher. That gets me closer but what I really need is a way to setup the view filter dynamically. I am going to have hundreds of pages and hundreds of posts.
This means that my view is actually going to sit in the theme template for certain pages rather than on the individual page. So my filter needs to be something like:
Display posts that have Locations the same as this Page's locations.
See attached image for example.
Hi,
For that dynamic functionality, you need to find a way to provide value to the view.
You can use the URL Parameter option from the screenshot you provided. Then you need to use ?=term-name on URL to dynamically feed the term in question to the view.
For more information:
https://toolset.com/course-lesson/filtering-custom-lists-of-posts/
Thanks.
I found a way to do this:
I created a view called "Related Content" and selected posts and pages. The Locations taxonomy I am using is available for selection in both posts and pages.
For filtering on the view, I used "Select posts with taxonomy: Locations the same as the current archive page". I then added the view to the archive page template and it works like a charm.
For example: I have a Location term called "Seattle". I then created posts and checked "Seattle" under the locations taxonomy and saved them. When I load the Seattle Archive page, only the posts that are checked "Seattle" display on the page.