PHP 示例WP_Query

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 示例WP_Query相关的知识,希望对你有一定的参考价值。

<?php 

	// Start WP_Query for only the ID's from above
	$first_query = new WP_Query(
	array(
		'post_type' => 'page',
		'post__in' => array(6,7,8),
        'category_name' => 'stuff',
		)
	); 

?>

<?php while($first_query->have_posts()) : $first_query->the_post(); ?>
	<?php the_title(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>

以上是关于PHP 示例WP_Query的主要内容,如果未能解决你的问题,请参考以下文章