<?php
$categories = get_categories(‘child_of=68’);
foreach($categories as $category) {
$cat_id = $category->term_id;
$current_posts = get_objects_in_term( $cat_id, ‘category’ );
$current_tags = wp_get_object_terms( $current_posts, ‘post_tag’ );
if ($current_tags) {
echo ‘<div class=”accordion main_c”><input type=”checkbox” id=”label’ .$cat_id. ‘” class=”accordion_input” /><label for=”label’ .$cat_id. ‘”><a href=”‘ .get_category_link( $category->term_id ). ‘”>’ .$category->cat_name. ‘(’ .$category->count. ‘)</a></label><div class=”accordion_content”>’ . “\n”;
echo ‘<ul>’;
foreach ( $current_tags as $tag ) {
$tagId = $tag->term_id;
$tagName = esc_attr($tag->name);
$tagLink = esc_url(get_tag_link($tagId));
if ( $tag->count==1 ) {
echo ‘<li><a class=”tagid’ . $tagId . ‘” href=”‘ . $tagLink . ‘”>’ . $tagName . ‘</a></li>’;
} else {
echo ‘<li><a class=”tagid’ . $tagId . ‘” href=”‘ . $tagLink . ‘”>’ . $tagName . ‘<span>(’ . $tag->count . ‘)</span></a></li>’;
}
}
echo ‘</ul></div></div>’;
}
}
?>
$categories = get_categories(‘child_of=68’);
foreach($categories as $category) {
$cat_id = $category->term_id;
$current_posts = get_objects_in_term( $cat_id, ‘category’ );
$current_tags = wp_get_object_terms( $current_posts, ‘post_tag’ );
if ($current_tags) {
echo ‘<div class=”accordion main_c”><input type=”checkbox” id=”label’ .$cat_id. ‘” class=”accordion_input” /><label for=”label’ .$cat_id. ‘”><a href=”‘ .get_category_link( $category->term_id ). ‘”>’ .$category->cat_name. ‘(’ .$category->count. ‘)</a></label><div class=”accordion_content”>’ . “\n”;
echo ‘<ul>’;
foreach ( $current_tags as $tag ) {
$tagId = $tag->term_id;
$tagName = esc_attr($tag->name);
$tagLink = esc_url(get_tag_link($tagId));
if ( $tag->count==1 ) {
echo ‘<li><a class=”tagid’ . $tagId . ‘” href=”‘ . $tagLink . ‘”>’ . $tagName . ‘</a></li>’;
} else {
echo ‘<li><a class=”tagid’ . $tagId . ‘” href=”‘ . $tagLink . ‘”>’ . $tagName . ‘<span>(’ . $tag->count . ‘)</span></a></li>’;
}
}
echo ‘</ul></div></div>’;
}
}
?>