我在category.php
此代碼,我要顯示在其中,我的類別,「$cat
」,並提到id
63類我寫的東西,但不想工作職位:/WordPress的獲取類ID數組
<?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
?
在此先感謝您的幫助!