Adding post ID as a class to attachment images
-
I have this code and it was working earlier but recently it stopped working, not sure why.
function addclassfeaturedimage($attr) { remove_filter('wp_get_attachment_image_attributes','addclassfeaturedimage'); $attr['class'] .= get_the_ID() ; return $attr; } add_filter('wp_get_attachment_image_attributes','addclassfeaturedimage');
When working it adds the post ID to the attachment image class.
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding post ID as a class to attachment images’ is closed to new replies.