Get Custom Post Type Categories Hierarchy and Add Custom Attribute to Each
-
Been struggling with this problem for a week now, I guess it’s time to ask for help:
In short, I am trying to hack a theme and below code:$output.='<span class="sort current_choice" data-id="hentry">All</span><span class="filter-sep">|</span>'; foreach ($terms as $term) { $i++; $output.='<span class="sort" data-id="'.$term->slug.'">'.$term->name.'</span>'; if( $i != $numItems ) { $output .= '<span class="filter-sep">|</span>'; } }
It stores all the things in $output and it returns a list Portfolio categories(custom post type)with no hierarchy. I am trying get the category list with hierarchy with hover dropdown menu.
What makes it hard is that the filtering Javascript animation needs each item to havedata-id=" "
to make it works, which is the slug.
$output.='<span class="sort" data-id="'.$term->slug.'">'.$term->name.'</span>';
Any idea?? ThanksPlease help
- The topic ‘Get Custom Post Type Categories Hierarchy and Add Custom Attribute to Each’ is closed to new replies.