루프에서 필터 (슬러그)를 제외하려고합니다. 나는 exclude를 연구하여 코드의 여러 위치에서 시도했다. 보통 나는 그 페이지를 깬다. 이 코드는 슬러그 20을 제외하기 위해 변경하려고 시도하고 있습니다. 'american'이라는 필터입니다. 나는 배열의 시작 부분에서 제외하려고했으나 작동하지 않았다. 그런 다음 foreach ($ catz $ cat) 섹션 다음에 시도했습니다. 나는 이것을 'exclude = 20 & title_li ='시도했다. 나는 cat = -20과 다양한 조합을 시도했다. 어떤 도움이라도 대단히 감사 할 것입니다. 당신이 ID로 게시물을 필터링하려면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'를 사용하면 데이터와 마음의 평화를보다 잘 제어 할 수 있습니다 :) –