Tsuyoshi. 様
ありがとうございます!
無事にif( count( $children ) == 0 )にて希望の動作が実現できました。
具体的には下記のようにいたしました。
<?php
$categories = get_terms('samplecat','orderby=order&order=ASC&parent=0');
foreach ( $categories as $cat ) {
echo '<h1>' . esc_html($cat->name) . '</h1>';
$children = get_terms('samplecat','hierarchical=0&orderby=order&order=ASC&child_of='.$cat->term_id);
if( count( $children ) == 0 ) {
//タクソノミー出力
}
foreach ( $children as $child ) {
echo '<h2>' . esc_html($child->name) . '</h2>';
$catslug = $child->slug;
$myquery = 'post_type=sample&samplecat=' . $catslug . '&showposts=-1';
?>
<?php query_posts($myquery); ?>
<?php if(have_posts()): while(have_posts()): the_post(); ?>
"><?php the_title(); ?>
<?php endwhile; endif; ?>
<?php
}
}
?>
また、大変ためになるページのご紹介もいただきましてありがとうございました。