Home › Forums › General Issues › adding a class to image attachment › Reply To: adding a class to image attachment
OK Found it.
As per the Code reference, the function uses four values:
wp_get_attachment_image( int $attachment_id, string|array $size = 'thumbnail', bool $icon = false, string|array $attr = '' )
Where I use only three. If I add the fourth value like so:
echo wp_get_attachment_image($image, $size, "",array('class' => 'rounded-top') );
It works. So problem solved.
What makes it hard to spot the fault is that WP seems to use four values where in this case the four values seem required?
Anyway, thanks for looking into this and pointing me toward the code reference.
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.