I need to output a list of SUB-categories that have a taxonomy slug that includes the current CPT's slug.
I have a CPT called "Service Areas".
The (hierarchical!) taxonomy is called "Service Area Categories"
Example:
Environmental <-- Service Area AND Top level Service Area Category
Hazardous Materials <-- Subcategory
Wastewater <-- Subcategory
etc
Transportation <-- Service Area AND Top level Service Area Category
Airport Engineering <-- Subcategory
Bicycle and Pedestrian Facilities <-- Subcategory
etc
On each Service Area page, I want to display a view with ONLY the subcategories (children) that match the current Service Area's subcategories.
The WordPress code for this is:
[code]<?php
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
if ($term->parent == 0) {
$args = array(
'taxonomy' => 'subject',
'depth' => 1,
'show_count' => 0,
'title_li' => '',
'child_of' => $term->term_id
);
wp_list_categories($args);
} else {
$args = array(
'taxonomy' => 'subject',
'depth' => 1,
'show_count' => 0,
'title_li' => '',
'child_of' => $term->parent
);
wp_list_categories($args);
}
?>[/code]
... but I need to convert this to a Toolset view/query, probably by creating a shortcode? Get term slug from current page and output children?
Hello. Thank you for contacting the Toolset support.
Can you please share example service area page and share details on that service area page what child terms you want to display and what exactly the information you want to display and on what section of the page.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
On the View that you created, you added a taxonomy filter to display the child categories of "Planning", so the view displays only "Planning" subcategories... NOT the child categories of the current page. It looks like you've included the conditional in the "Custom code", so can/should this taxonomy filter be removed?
Also, can the view easily be converted to blocks so that I can format the output?