// By Cat
$args = array(
'hierarchical' => false,
'parent' => 0,
'hide_empty' => (int)get_option('jr_show_empty_categories'),
);
$terms = get_terms( 'job_cat', apply_filters('jr_nav_job_cat', $args) );
if ($terms) :
echo '<li><a class="top" href="#open">'.__('Job Category', 'appthemes').'</a> <ul>';
foreach($terms as $term):
echo '<li class="page_item ';
if ( isset($wp_query->queried_object->slug) && $wp_query->queried_object->slug==$term->slug ) echo 'current_page_item';
echo '"><a href="'.get_term_link( $term->slug, 'job_cat' ).'">'.$term->name.'</a></li>';
if ( ! $term->count ):
// echo terms childrens
$children = get_term_children($term->term_id, 'job_cat');
if ( is_array( $children ) ) foreach($children as $child):
$child_term = get_term_by('id', $child, 'job_cat');
echo '<li class="page_item page_item_children ';
if ( isset($wp_query->queried_object->slug) && $wp_query->queried_object->slug==$child_term->slug ) echo 'current_page_item';
echo '"><a href="'.get_term_link( $child_term->slug, 'job_cat' ).'">- '.$child_term->name.'</a></li>';
endforeach ;
endif;
endforeach;
echo '</ul></li>';
endif;
There are currently 1 users browsing this thread. (0 members and 1 guests)