0
글자가 글래스고와 신부 액세서리가 아닌 두 개의 개별 택 소니와 일치하는 경우 게시물을 표시하려고합니다.Wordpress wp_query에 두 개의 분류가있는 게시물 표시
아래의 wp_query 루프 코드를 통해 두 분류에서 모두 결과를 볼 수 있습니다. 그러나 두 범주가 모두 선택된 게시물 만 표시하려면 루프가 필요합니다.
<?php
/**
* Create a new WP_Query
* Set $wp_query object to temp
* Grab $paged variable so pagination works
*/
?>
<?php
global $wp_query; $post; $post_id = $post-> ID;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
rewind_posts();
$temp = $wp_query;
$wp_query = NULL;
$post_type = 'place'; // change this to the post type you want to show
$show_posts = '30'; // change this to how many posts you want to show
$category_name = 'bridal-accessories-free,special-offer' // change this to the category name you need
?>
<?php $wp_query = new WP_Query('placecategory=' . $category_name . '&post_type=' . $post_type . '&posts_per_page=' . $show_posts . '&paged=' . $paged); ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<p style="font-size: 15px; margin-bottom: 10px;"><span style="font-weight: normal; margin-right: 5px; text-transform: uppercase; color: #a5cc8e;"><?php the_title(); ?></span> <span style="margin-right: 5px; color: #000;"><?php echo get_post_meta($post->ID,'geo_address',true);?></span> <?php $contact = stripslashes(get_post_meta($post->ID,'contact',true));
if($contact && get_option('ptthemes_contact_on_detailpage') == 'Yes') { ?><?php echo PHONE.": "; ?> <?php echo $contact;?><?php } ?>
<?php endwhile; ?></p>
<?php wp_reset_query(); ?>
</div>
이렇게 할 수 있으면 루프 쿼리 변수를 URL에 전달할 수 있습니까? 결과에 대한 링크를 만들려면이 항목이 필요합니다.
미리 감사드립니다.