2011-03-23 75 views
0

您好我有最新的新闻和I输出10个职位为猫在头版如何检查一类的很多职位如何在其他类别的前10个职位WordPress的

我也有类别的类别 -enviroment -politics -sports

和I输出5个员额为每一个在头版

我想检查我已经可以说,从政治3个员额中的最新消息第一10个职位类别如何将政治猫中显示的帖子设置为3在那个猫的帖子,所以我没有重复的内容在头版。可以说我有最新的新闻猫的环境5职位。以及我想要抵消环境猫的职位5等。

希望有人能帮助我:D谢谢!

+0

我的回答没有帮助你吗? – 2011-03-30 02:34:27

回答

1

当你做对循环显示在环境类职位,例如,你可以存储后> ID,然后你把它作为“排除”在你的最新环参数..

这可能是像这样:

<?php 
$exclude = array(); //this stores what should not be shown 
$args = array('numberposts' => 5, 'category' => [enviromentID]); 
$lastposts = get_posts($args); 
foreach($lastposts as $post) : setup_postdata($post); 
    //your usual theming stuff here 
    $exclude[] = $post->ID; 
endforeach; 
//same thing to the other categories 
$args = array('numberposts' => 5, 'category' => [latestID], 'exclude' => $exclude); 
//usual get posts loop here 
?> 
相关问题