Support

Account

Home Forums General Issues adding a class to image attachment Reply To: adding a class to image attachment

  • Hi John,

    Question: is the class populated with anything?

    I use the class in other places on the site if that is what you mean?

    Possibly there is a filter on ‘wp_get_attachment_image_attributes

    mmhh, I looked for something like that but could not find anything. Are you saying the code is correct and should work?

    I use <?php the_post_thumbnail('large', array('class' => 'rounded-top')); ?> in other places on the site and that works. My rounded-top class is added to the wp-post-image class.

    I tried using

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

    In twenty-ten and it does not work either. The only classes I see is attachment-full size-full In the ACF field settings I use the “ID” since I want the srcset thing.

    Thanks