私の single.php では、開いた投稿を除くすべてのカテゴリの投稿を表示したいと考えています。
これが私のコードです:pastebin.comループコード
カテゴリ投稿ループのコードは次のとおりです。すべてのカテゴリ投稿と開かれた投稿をループします。開いた投稿を再度ループしたくありません
<?php $catid = the_category_ID( false ); ?> 
                        <?php $postCount = 1; $loop = new WP_Query( array( 'tax_query' => array(array(
                                'taxonomy' => 'category',
                                'field' => 'id',
                                'terms' => $catid
                            )), 'post_type' => 'post', 'posts_per_page' => 15 ) ); if ($loop->have_posts()) { ?>
アップデート:
私は解決策を持っています:
<?php $catid = get_the_category(); $catid = $catid[0]->term_id; ?>
                        <?php $postCount = 1; $loop = new WP_Query( array( 'tax_query' => array(array(
                                'taxonomy' => 'category',
                                'field' => 'id',
                                'terms' => $catid
                            )),
                            'post_type' => 'post',
                            'posts_per_page' => 15,
                            'post__not_in' =>array($post->ID) ) );
                        if ($loop->have_posts()) { ?>
「post_not_in」オプションを使用する必要があります。