正如汤姆所说,你不应该使用query_posts
并且应该总是将任何参数作为数组传递。
我认为这将实现您的目标:
<?php
// Arguments
$args = array(\'
\'nopaging\' => true,
\'terms\' => \'featured\',
\'posts_per_page\' => 15,
\'orderby\' => \'rand\',
\'order\' => \'DESC\',
\');
// The query
$the_query = new WP_Query( $args );
// The loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
/*
Output here, e.g.
echo \'<h2>\' . get_the_title() . \'</h2>\';
echo \'<div>\' . get_the_content() . \'</div>\';
*/
}
}
?>