vickyboy
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Post Type UI] List taxonomy term children used by postsCompletely my fault for not explaining it properly. Thanks for the help.
Forum: Plugins
In reply to: [Custom Post Type UI] List taxonomy term children used by postsI have managed to resolve this using the term_children function
<?php
$term_children = get_terms(
‘brands’,
array(
‘parent’ => get_queried_object_id(),
)
);
if ( ! is_wp_error( $terms ) ) {
foreach ( $term_children as $child ) {
echo ‘
<div class=”repair__step”>
‘ . $child->name . ‘
</div>’;
}
}
?>It is now displaying the term children which are used within the posts.
- This reply was modified 5 years, 4 months ago by vickyboy.
Forum: Plugins
In reply to: [Custom Post Type UI] List taxonomy term children used by postsThank you for your reply. As I understand it this will bring up a list of the taxonomy parent terms? But I need to show a list of the term children. I don’t think I explained it very well and I have limited experience with CPT.
I have a hierarchical taxonomy called Brands: Apple, Samsung, Sony, etc… then under each of these I have the models such as iPhone 8, iPhone X, iPhone XS, etc.. it’s these which I need to list on it’s own taxonomy template with links to their posts.
E.g: Apple -> iPhone 8 -> show list of all posts relating to iPhone 8
This is basically a step by step post search. So on one page the user selects the brand (Apple, Samsung, etc) and when they click on one it’s models will appear (the term children – iPhone 8, X, XS, etc) on a separate page. Then when a model is clicked, the posts relating to that device will be listed.