<ul class="bigarea">
<?php
$terms = get_terms([
'taxonomy' => 'shop_area',
'hide_empty' => false,
'parent'=>0,
]);
foreach( $terms as $term){?>
<li>
<figure>
<?php the_term_thumbnail($term ->term_id, 'post-thumbnail');?>
<figcaption>
<?php echo $term->name; ?>
</figcaption>
</figure>
<ul class="cityname">
<?php
$taxonomy_name = 'shop_area';$termchildren = get_term_children( $term->term_id, $taxonomy_name );
foreach ( $termchildren as $child ) {
$term = get_term_by( 'id', $child, $taxonomy_name );
echo '<li><a class="each-item" href="#'.$term->term_id.'">' . $term->name . '</a></li>';?>
<?php }?>
</ul>
</li>
<?php };?>
</ul>