にカテゴリIDを取得し、私はcategory.php
でこのコードを持っていると私は私がしたカテゴリ、「$cat
」と私は何かを書きましたが、仕事をしたくはありませんid
63と呼ばカテゴリからの投稿を表示します:/WordPressの配列
<?php
$cat->term_id;
$my_query_args = array(
'posts_per_page' => 6,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => array(63, $cat),
'operator' => 'AND'
)
)
);
$my_query = new WP_Query($my_query_args);
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
endif;
wp_reset_postdata();
?>
誰かがなぜ$cat
に現在表示されているカテゴリは発生しません教えてもらえますか?
ご協力いただきありがとうございます。