J'ai ce code dans category.php
et je veux afficher les messages de la catégorie dans laquelle je suis, "$cat
" et la catégorie visée id
63. J'ai écrit quelque chose, mais je ne veux pas travailler:/WordPress obtenir l'ID catégorie à Array
<?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();
?>
quelqu'un peut-il me dire pourquoi ne pas engager la catégorie actuellement affichée à $cat
?
Merci d'avance pour votre aide!