【问题标题】:Divi + Woocommerce Shop Module = Show Category of product working snippet with no issues? [duplicate]Divi + Woocommerce 商店模块 = 显示产品工作片段的类别没有问题? [复制]
【发布时间】:2021-05-17 08:59:00
【问题描述】:

ET 在他们的商店模块上不包括类别显示的开/关,这超出了我的范围,所以在这里......

【问题讨论】:

    标签: woocommerce module categories shop divi


    【解决方案1】:
    add_action( 'woocommerce_after_shop_loop_item_title', 'after_shop_loop_item_title', 1 );
    function after_shop_loop_item_title() {
       global $post;
       $terms = get_the_terms( $post->ID, 'product_cat' ); 
       foreach ($terms as $term) {
           $term_link = get_term_link( $term );
           echo '<span> <a href="' . esc_url( $term_link ) . '">' .$term->name .'</a> </span>';
       }
    }
    

    【讨论】:

      猜你喜欢
      • 2020-11-26
      • 2021-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      • 2018-09-29
      • 1970-01-01
      相关资源
      最近更新 更多