Tell us what you are trying to do?
I am developing a directory site. The site will have 2 custom post types (City and Business). An example of the permalink of those is below:
mysite.com/city/austin-tx
mysite.com/business/joe-the-plumber
I have a one to many relationship with city to businesses. There will be multiple kinds of businesses. For this example, let's say that there are plumbers and electricians.
I have built a city post template that includes a view of all businesses associated with the city. That URL is mysite.com/city/austin-tx
I would like to be able to have a URL that filters for a specific type of business. For example, mysite.com/city/austin-tx/plumbers
I would like that plumber page to show only the plumbers in Austin but also allow me to write some unique content that is different than the regular austin-tx page.
I'm thinking I need to use either tags or categories but those require a different base URL (i.e., mysite.com/business-type/plumbers) which doesn't work because I only want to show plumbers in Austin.
Hello,
There isn't such kind of built-in feature within Toolset plugins.
As a workaround, you might try with WordPress hierarchical custom post type.
For example:
1) Edit the custom post type "city", enable options "hierarchical" + "Page Attributes"
2) Add "plumbers" sub posts for each city post
3) Create a content template, for example "parent-city-info", display a post view:
- Query business posts
- Filter by post type relationship between "City" and "business"
- In view's loop, display business post information
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items
4) In single "plumbers" sub post, display above content template with item attribute, for example:
[wpv-post-body view_template="parent-city-info" item="$parent"]
More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
$parent is used to retrieve data from a hierarchical parent if the current post is a type of hierarchical post such as a page