1
我有一个组合的Wordpress页面,我需要排序这首先显示选择“精选”类别的帖子。排序帖子显示第一个帖子与选定的类别
所有的项目都有一个类似“桌子”,“椅子”......我可以过滤,但我需要,如果我标记与“精选”类别的项目,这出现在顶部的列出我是否将所有产品或产品展示在类别中(ej:表格)。
你能帮我吗?
在此先感谢
我有一个组合的Wordpress页面,我需要排序这首先显示选择“精选”类别的帖子。排序帖子显示第一个帖子与选定的类别
所有的项目都有一个类似“桌子”,“椅子”......我可以过滤,但我需要,如果我标记与“精选”类别的项目,这出现在顶部的列出我是否将所有产品或产品展示在类别中(ej:表格)。
你能帮我吗?
在此先感谢
最后,我已经解决了这个问题,这种方法:
<?php
//Get posts with "Featured" category
$featured= query_posts('post_type=portfolio&projecttype=featured&posts_per_page=-1');
//Get all posts
$posts=query_posts('post_type=portfolio&project-type='. query_categories() .'&posts_per_page=-1');
//I merge removing duplicated posts with array_unique
$final_posts = array_unique(array_merge($destacados, $posts), SORT_REGULAR);
foreach ($final_posts as $key => $post) {
setup_postdata($post);
//Use wp methods to show info (ej:the_title();)
}
?>
粘贴您使用功能比其他类别排序的代码 –