query_post problem

时间:2011-08-30 作者:sico87

我正在使用以下参数运行query\\u post,

<?php $args = array(
\'category\'        => $cat,
\'orderby\'         => \'post_date\',
\'order\'           => \'DESC\',
\'post_type\'       => \'blog\',
\'post_status\'     => \'publish\' ); 
?>

$cat=7在本例中,它应该返回1个帖子,但如果我的帖子属于任何类别,它将返回我的所有帖子。

1 个回复
最合适的回答,由SO网友:Manny Fleurmond 整理而成
       // Category should be \'cat\'
    <?php
 $args = array( \'cat\' => $cat, \'orderby\' => \'post_date\', \'order\' => \'DESC\', \'post_type\' => \'blog\', \'post_status\' => \'publish\' );

        ?>
结束