2012-08-02 2 views
0

나는 "제품"이라고하는 워드 프레스 분류법을 사용하고 있습니다. 내 택 소노 미의 템플릿 파일은 taxonomy-product.php가 될 것입니다. 그러나 기본 wordpress post 루프를 사용하면 기본 "게시물"분류의 게시물을 표시하고 "제품"이라는 사용자 정의 태그는 표시하지 않습니다.분류 체계의 게시물을 표시 할 수 없습니까?

어떻게 해결할 수 있습니까? 이 내가 분류-product.php

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
<div class="product"> 
<?php the_post_thumbnail();?> 
<h2 class="product-title"> 
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a> 
</h2> 
<a class="product-view" href="<?php the_permalink() ?>">View Product</a> 
</div> 
<?php endwhile; else: ?> 
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p> 
<?php endif; ?> 

답변

0

칼리의 내부에 배치 한 내 코드입니다, 당신이 가지고있는 문제는 당신이 당신의 루프의 내부를 통해 루프하고자하는 분류를 포함하지 않는 것입니다. 사용해보기 :

<?php 

$args = array('product' => 'example-product'); 
$loop = new WP_Query($args); 

while ($loop->have_posts()) : $loop->the_post(); 

<div class="product"> 

    <?php the_post_thumbnail();?> 

    <h2 class="product-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> 

    <a class="product-view" href="<?php the_permalink() ?>">View Product</a> 

</div> 

<?php endwhile; else: ?> 

<p><?php _e('Sorry, no posts matched your criteria.'); ?></p> 

endwhile; 

?> 
관련 문제