php if $this-category == law 如何显示3篇文章
'post',
'posts_per_page' => 3,
'category_name' => 'law'
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<div><?php the_content(); ?></div>
<?php endwhile;
endif;
wp_reset_postdata(); ?>
原文地址: https://www.cveoy.top/t/topic/fmyt 著作权归作者所有。请勿转载和采集!