Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress循环从第三篇文章开始_Php_Wordpress - Fatal编程技术网

Php Wordpress循环从第三篇文章开始

Php Wordpress循环从第三篇文章开始,php,wordpress,Php,Wordpress,我搜索了很多,但没有得到确切的答案,我希望我的Wordpress循环开始从最近发布的第三篇文章中选择两篇文章,按类别排序,如新闻。我怎么做? 我想就像在SQL中一样 SELECT * FROM tbl ORDER BY date DESC LIMIT 2,2; 您可以尝试以下代码: query_posts('offset=2&posts_per_page=2&cat=<id_of_cat>'); while ( have_posts() ) : the_p

我搜索了很多,但没有得到确切的答案,我希望我的Wordpress循环开始从最近发布的第三篇文章中选择两篇文章,按类别排序,如新闻。我怎么做? 我想就像在SQL中一样

SELECT * FROM tbl ORDER BY date DESC  LIMIT 2,2;

您可以尝试以下代码:

query_posts('offset=2&posts_per_page=2&cat=<id_of_cat>');
    while ( have_posts() ) : the_post(); 
    endwhile;
希望能有帮助