그룹상품 제품 이미지


[php]
add_action</span><span class="pun">(</span> <span class="str">'woocommerce_grouped_product_list_before_price'</span><span class="pun">,</span> <span class="str">'woocommerce_grouped_product_thumbnail'</span> <span class="pun">);</span>

<span class="kwd">function</span><span class="pln"> woocommerce_grouped_product_thumbnail</span><span class="pun">(</span><span class="pln"> $product </span><span class="pun">)</span> <span class="pun">{</span><span class="pln">
    $image_size </span><span class="pun">=</span><span class="pln"> array</span><span class="pun">(</span> <span class="lit">20</span><span class="pun">,</span> <span class="lit">20</span> <span class="pun">);</span>  <span class="com">// array( width, height ) image size in pixel </span><span class="pln">
    $attachment_id </span><span class="pun">=</span><span class="pln"> get_post_meta</span><span class="pun">(</span><span class="pln"> $product</span><span class="pun">-></span><span class="pln">id</span><span class="pun">,</span> <span class="str">'_thumbnail_id'</span><span class="pun">,</span> <span class="kwd">true</span> <span class="pun">);</span>
    <span class="pun">?></span>
    <span class="pun"><</span><span class="pln">td </span><span class="kwd">class</span><span class="pun">=</span><span class="str">"label"</span><span class="pun">></span>
        <span class="pun"><?</span><span class="pln">php echo wp_get_attachment_image</span><span class="pun">(</span><span class="pln"> $attachment_id</span><span class="pun">,</span><span class="pln"> $image_size </span><span class="pun">);</span> <span class="pun">?></span>
    <span class="pun"></</span><span class="pln">td</span><span class="pun">></span>
    <span class="pun"><?</span><span class="pln">php>

}

[/php]