2012-03-28 38 views
0

我想爲產品詳細信息頁面中的產品創建類別循環。 (在產品下面)。產品將來自產品項目所屬的同一類別。Wordpress WP-E-Commerce插件。需要創建類別循環

似乎正常的類別參數不符合標準的Wordpress參數。 WPEC的自定義模板標籤,如wpsc_print_category_image()wpsc_print_category_name();似乎不能在自定義設置中工作。

這裏是什麼,我試圖做

<?php 
$args = array('post_type' => 'wpsc-product','posts_per_page' => 999, 'orderby'=>'title','order'=>'ASC','category_id'=>'5'); 
$loop = new WP_Query($args); 

while ($loop->have_posts()) : $loop->the_post(); 
    //the_title(); 
    echo '<div class="isotope-item box default_product_display product_view_'; 
    echo wpsc_the_product_id(); 
    echo '">'; 
    echo '<img src="'; 
    echo wpsc_the_product_image(); 
    echo '"/>'; 
    ?> 
    <div class="prod-info-container"> 

      <div class="prod-info"> 

      <h3 class="prodtitle entry-title"> 
          <?php if(get_option('hide_name_link') == 1) : ?> 
           <?php echo wpsc_the_product_title(); ?> 
          <?php else: ?> 
           <?php echo wpsc_the_product_title(); ?> 
          <?php endif; ?> 
         </h3>  

          <p> 


          <?php echo the_excerpt(); ?> 
         </p><!--close wpsc_description--> 
         <a class="view-detail" href="<?php the_permalink();?>">view</a> 
      </div> 
      </div>   
    <?php 
    echo '</div>'; 
endwhile; 
?> 

一個例子這給了我所有的產品,但我想限制到只有一個類別。

謝謝。

回答

1

這是我落得這樣做:

$category = get_the_category(); 
$wpsc_product_category = get_the_product_category(wpsc_the_product_id()); 
$curr_cat = $wpsc_product_category[0]->slug;