Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11716

    I am wanting to add a banner image or graphic underneath the shop products in just a single category to highlight a specific facet of the category items – in this case “commercial-solar-products” – I cant see any way of doing it but logic tells me there should be a way:-) Are you able to help?

    The category is here: http://tradesolarkits.com/shop/product-category/commercial-solar-products/

    I know you have previously had a 404 from my site for some reason here is a link to a screenshot if the above link doesn’t work

    http://dl.dropbox.com/u/3614813/screenshot.jpg

    Many thanks

    Martin

    #72759

    Hello,

    You can add this on the your shop template. This will enable you filter the category commercial-solar-products and add a banner image to it. You just need to find the category number and place it on the snippet.

    <?php $cats = get_terms( 'product_cat', array(
    'orderby' => 'count',
    'hide_empty' => 0,
    'include' => 14
    ) );
    ?>

    <?php foreach ($cats as $cat) :

    $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
    if ($thumbnail_id)
    $image = wp_get_attachment_url( $thumbnail_id );
    echo '<li><a href="'.get_term_link( $cat->slug, 'product_cat' ).'"><img src="'.$image.'" />'.$cat->name.'</a></li>';
    ?>

    <?php endforeach; ?>

    Edit the include arguments to the category ID of commercial solar products.

    Regards,

    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Adding a graphic to a single category of woocommerce only’ is closed to new replies.