Problem:
Client has a hierarchical taxonomy and only wants to show something on parent term archive pages, not child term archive pages. What test can be included in a wpv-conditional shortcode?
Solution:
You would need to register a custom function that checks whether the current term for the taxonomy archive being viewed has parents or not, which can then be used as the conditional in a wpv-conditional shortcode (after registering the custom function), e.g.
function tssupp_archive_term_is_parent(){ global $wp_query; $tax = $wp_query->get_queried_object(); return $tax->parent == 0; }
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-custom-functions-in-conditions/
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 2 replies, has 2 voices.
Last updated by 6 years, 5 months ago.
Assisted by: Nigel.