Location Search

$term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); // get current term
$parent = get_term($term->parent, get_query_var(‘taxonomy’) ); // get parent term
$children = get_term_children($term->term_id, get_query_var(‘taxonomy’)); // get children
// Category Views
if (!is_single()) {
// Main Categories
if (!$parent->term_id && sizeof($children) > 0) {
echo ‘YOURE INSIDE A CATEGORY’;
$args = array(
‘child_of’ => $term->term_id,
‘taxonomy’ => $term->taxonomy,
‘hide_empty’ => 1,
‘hierarchical’ => true,
‘depth’ => 1,
‘title_li’ => ”
);?>


// Sub-Categories
} elseif ($parent->term_id && sizeof($children) == 0) {
echo ‘YOURE INSIDE A SUB-CATEGORY’;
$subterm = get_queried_object();
$tax = ‘yourtaxonomy_type’;
$parents = $subterm->parent;
$term_id = $subterm->term_id;
echo “

“;
wp_reset_postdata();
wp_list_categories( array (
‘taxonomy’ => $tax,
‘pad_counts’=> 0,
‘title_li’ => ”,
‘child_of’ => $subterm->parent,
));
echo “
“;
}
// Single Views
} else {
echo ‘YOURE INSIDE A SINGLE’;
//still trying to figure out how to show the single’s category and siblings.
}
?>