Al Mahbub Khan’s Post

View profile for Al Mahbub Khan, graphic

Adobe Certified Magento 2 Frontend Exper,CEO at Smartupworld.

smartupworld.com #smartupworld Get the custom taxonomy terms that belong to the current post – Taxonomy hierarchy on a single post https://lnkd.in/eUd2WT24 Get Custom Category from Single Custom Post Type foreach ( $terms as $term ) {// this gets the parent of the current post taxonomy if ($term->parent == 0) {$myparent = $term;} } echo ' '.$myparent->name.''; // Right, the parent is set, now let's get the children foreach ( $terms as $term ) { // this ignores the parent of the current post taxonomy if ($term->parent != 0) { // this gets the children of the current post taxonomy $childterm = $term; //printr($childterm); echo ' / '.$childterm->name.''; } } ?>

Get the custom taxonomy terms that belong to the current post – Taxonomy hierarchy on a single post

Get the custom taxonomy terms that belong to the current post – Taxonomy hierarchy on a single post

https://smartupworld.com

To view or add a comment, sign in

Explore topics