<div class="p-post__other<?php if(is_singular('construction')){echo ' p-post__other--bg';} ?>">
    <div class="p-post__inner l-inner">
        <p class="p-post__entitle c-entitle c-entitle--capitalize">list of individual achievements</p>
        <h2 class="p-post__title c-title">個別実績一覧</h2>
        <div class="p-post__achievements">
            <?php
            $target_post = 'construction';
            $target_post_cat = 'construction-cat';
            $post_count = -1;
            $cat_args = array(
                'parent' => 0, //トップレベルのタームのみ
                'hierarchical' => 0 //子タームを含めない
            );
            $cats = get_terms($target_post_cat, $cat_args);
            foreach( $cats as $cat ):
                $target_cat_slug = esc_html($cat -> slug);
                $target_cat_name = esc_html($cat -> name);
                echo '<div class="p-post__achievement">';
                echo '<h3 class="p-post__theme">'. $target_cat_name .'</h3>';
                $args = array(
                    'post_type' => array($target_post),
                    'taxonomy' => $target_post_cat,
                    'term' => $target_cat_slug,
                    'post_status' => 'publish',
                    'posts_per_page' => -1, // 表示するページ数
                );
                $my_query = new WP_Query($args);
                if( $my_query->have_posts() ) :
                ?>
                    <div class="p-post__achievementList">
                        <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
                            <a href="<?php the_permalink(); ?>" class="p-post__achievementlink"><?php the_title(); ?></a>
                        <?php endwhile; ?>
                    </div>
                <?php
                endif;
                echo '</div>';
                wp_reset_postdata();
            endforeach;
            ?>
        </div>
    </div>
</div>