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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.