开发者

Wordpress query, exclude latest post from a category

Is it possible to get posts from all categories but exlude only one latest post from specific categories. Something like: get posts from all ca开发者_开发百科tegories, but exclude latest post from category 2,4 and 5. PS. I'm looking for wordpress query (not mysql), for example somethng like

<?php $my_query = new WP_Query('showposts=10'); ?>

Thanks.


How about this:

<?php $my_query = new WP_Query('showposts=10&offset=1'); ?>

Does that work for you?


In MySQL, I would suggest something like this:

SELECT * FROM posts WHERE id NOT IN 
    (SELECT id FROM posts WHERE category IN (2,4,5) ORDER BY id DESC LIMIT 0,1)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜