Таксономия
0
Вклад в тег
<?php
$currentTerm = get_queried_object();
$children = get_term_children($currentTerm -> term_id, 'catalogs');
if($children): ?>
<?php
$args = array(
'taxonomy' => 'catalogs',
'hide_empty' => 1,
'depth' => 1,
'parent' => get_queried_object()->term_id
);
$terms = get_terms( $args );
$count = 1;
?>
<?php foreach ($terms as $term): ?>
<a href="<?php echo get_post_type_archive_link('catalog'); echo $term->slug ?>"><?php echo $term->name ?></a>
<?php endforeach; ?>
<?php else : ?>
<?php if ( have_posts() ) : while (have_posts()) : the_post();?>
<h2><?php the_title(); ?></h2>
<?php endwhile;?>
<?php endif;?>
<?php endif;?>