我想从循环中排除过滤器(slug)。我正在研究排除,并在代码中的各个地方尝试过。通常我会打破这个页面。这是代码,我试图改变排除slug 20.它是一个名为'美国'的过滤器。我试图排除在阵列的开始,没有工作;然后,我尝试了foreach($ catz as $ cat)部分。我试过这个'exclude = 20 & title_li ='。我尝试了猫= -20和其他各种组合。任何帮助将非常感激。wp如何从自定义查询中排除过滤器
// The Custom Query
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => $counter_folio,
'paged' => $paged,
'order' => 'DESC'
);
query_posts($args);
while(have_posts()) : the_post();
$color = substr(get_option('dcb_dynamic_color'), 1);
// Get the original thumbnail of the post
$src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false, '');
$excerpt = get_the_excerpt();
// Get the custom fields
$vimeo = get_post_meta($post->ID, "vimeo", true);
$youtube = get_post_meta($post->ID, "youtube", true);
// Get the filter > Category of item
$catz = wp_get_object_terms($post->ID,'filters');
foreach($catz as $cat){
$currcat = $cat->slug;
$catname = $cat->name;
break;
}
$counter++;
?>
排除它,请不要使用'query_posts'是坏的查询数据,它的问题和不可靠的。使用'WP_Query'来代替,你将会对你的数据有更多的控制并且安心:) – 2013-03-07 13:01:10