<h1>single_term_title</h1>
<ul>
<li><a href="">title-post-my_tax_term_name</a></li>
</ul>
<ul>
<li><a href="">title-post-my_tax_term_name</a></li>
</ul>
<nav class="main-navigation">
<?php
$term_slug = get_query_var('term');
$taxonomy = get_query_var('taxonomy');
$term = get_term_by( 'slug', $term_slug, $taxonomy );
$terms = get_terms($taxonomy, array(
'hide_empty' => 0,//true=1, false=0,
'hierarchical' => 1,//true=1, false=0,
//'childless' => true,
//'child_of' => $term->term_id,
'parent' => $term->term_id,
) );
$mytax_query = array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $term_slug,
'include_children' => true
)
);
$posts = get_posts( array(
'post_type' => 'notary',
'numberposts' => -1,
//'order' => 'asc',
'tax_query' => $mytax_query
) );
if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
echo '<div><ul>';
//. ' <p>ссылки на дочки <strong>'.$term_slug.'</strong>:</p>';
foreach ($terms as $term) {
echo '<li><a href="' . get_term_link( $term ) . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a></li>';
}
echo '</ul></div>';
} elseif (term_exists($term->term_id)) {
echo '<div><ul>';
//. ' <p>ссылки на посты в дочках <strong>'.$term_slug.'</strong>:</p>';
foreach ($posts as $post){
setup_postdata($post); ?>
<li class=""><?php echo '<a href="'. get_permalink( $post->ID ) .'">'. $post->post_title .'</a>';?></li>
<?php
}
echo '</ul></div>';
}
wp_reset_postdata();
?>
</nav>