categories - Woocommerce get category image full size

i'm trying to get the full size image of my category products. $prod_categories = get_terms( 'product_cat'

i'm trying to get the full size image of my category products.

    $prod_categories = get_terms( 'product_cat', array(
        'orderby'    => 'name',
        'order'      => 'ASC',
        'hide_empty' => true
    ));

    foreach( $prod_categories as $prod_cat ) :
        $cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
        $cat_thumb_url = wp_get_attachment_thumb_url( $cat_thumb_id );
        $term_link = get_term_link( $prod_cat, 'product_cat' );?>

        <a href="<?php echo $term_link; ?>"><img src="<?php echo $cat_thumb_url; ?>" alt="<?php echo $prod_cat->name; ?>" /></a>

    <?php endforeach; wp_reset_query();

The above code works, but it returns an image of 150px x 150 even when adjustments in Woocommerce are like this:

I´d like to get a larger size or full size. Thanks!

i'm trying to get the full size image of my category products.

    $prod_categories = get_terms( 'product_cat', array(
        'orderby'    => 'name',
        'order'      => 'ASC',
        'hide_empty' => true
    ));

    foreach( $prod_categories as $prod_cat ) :
        $cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
        $cat_thumb_url = wp_get_attachment_thumb_url( $cat_thumb_id );
        $term_link = get_term_link( $prod_cat, 'product_cat' );?>

        <a href="<?php echo $term_link; ?>"><img src="<?php echo $cat_thumb_url; ?>" alt="<?php echo $prod_cat->name; ?>" /></a>

    <?php endforeach; wp_reset_query();

The above code works, but it returns an image of 150px x 150 even when adjustments in Woocommerce are like this:

I´d like to get a larger size or full size. Thanks!

Share Improve this question asked Aug 30, 2015 at 17:43 Sema HernándezSema Hernández 1611 gold badge3 silver badges11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 6

Thanks to Mike Jolley (Woocommerce plugin author) for the solution using: wp_get_attachment_image_src

$prod_categories = get_terms( 'product_cat', array(
        'orderby'    => 'name',
        'order'      => 'ASC',
        'hide_empty' => true
    ));

    foreach( $prod_categories as $prod_cat ) :
        $cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
        $shop_catalog_img = wp_get_attachment_image_src( $cat_thumb_id, 'shop_catalog' );
        $term_link = get_term_link( $prod_cat, 'product_cat' );?>

        <a href="<?php echo $term_link; ?>"><img src="<?php echo $shop_catalog_img[0]; ?>" alt="<?php echo $prod_cat->name; ?>" /></a>

    <?php endforeach; wp_reset_query();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744852077a4597185.html

相关推荐

  • categories - Woocommerce get category image full size

    i'm trying to get the full size image of my category products. $prod_categories = get_terms( 'product_cat'

    2天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信