Problem:
I am trying to create a hierarchy in three levels
Level 1
/property-for-sale
Level 2
/property-for-sale/spain
/property-for-sale/madrid
/property-for-sale/valencia
/property-for-sale/nice
Level 3
/property-for-sale/madrid/apartment-in-serranos
/property-for-sale/madrid/apartment-in-la-moraleja
/property-for-sale/nice/mont-boron
/property-for-sale/nice/cimiez
I have tried to build this using both taxonomies and custom post types but do not manage to get it to work properly
Ideally, I would like it to work as follows
Level 1 and level 2 are both archive pages
However, the archive pages should only
- include children one level down
- and only those children that belong to a certain taxonomy
E.g, of the four level 2 examples above, only the following two belong to the ‘for sale’ taxonomy
- /property-for-sale/spain
- /property-for-sale/france
Consequently, on the ‘/property-for-sale’ archive page should only these two sections immediately above appear.
Solution:
There isn't such a built-in feature within Types plugin, but you can setup such kind of permalinks with only one "hierarchical" custom post type, just like the wordpress built-in post type "Page", for example:
1) You can create a custom post type "property-for-sale" with Types plugin
in section "Sections to display when editing ", enable option "Page Attributes",
in section "Options", enable option "hierarchical"
Then you will get a "hierarchical" custom post type
More help:
https://codex.wordpress.org/Function_Reference/register_post_type#rewrite
2) Then create a view to query the child posts, and display this in the level 1 and level 2 posts
Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-parent/
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 |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9: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/Hong_Kong (GMT+08:00)
This topic contains 9 replies, has 2 voices.
Last updated by Luo Yang 5 years, 10 months ago.
Assisted by: Luo Yang.