Support

Account

Home Forums General Issues add class to woocommerce single product template gallery thumbnails if media …

Helping

add class to woocommerce single product template gallery thumbnails if media …

  • the goal: add class to woocommerce single product template gallery thumbnails if media attachment ACF field toggled (true/false)

    i have the following custom field (quick_ship):

    i’ve added this in functions but not working at the moment:

    <?php

    $image = get_field('quick_ship');
    $size = 'full'; // (thumbnail, medium, large, full or custom size)
    if( $image ) {
    echo wp_get_attachment_image( $image, $size, array ('class' => 'quick-ship' ) );
    }

    thanks for any help.

  • You are missing the 3rd argument $icon

    
    echo wp_get_attachment_image( $image, $size, false, array ('class' => 'quick-ship' ) );
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.