how to append a CSS class to the feature image, per page, using custom fields?
-
Hi.
I’m trying to find a way to append a CSS class to the featured image if a custom field is present (the value of it being the CSS class). I want it to be a per post/page basis because disk space is an issue, so it needs to allow me to use the same image on two different posts/pages with different values for the custom field or even using only the custom field in one of the pages.
So far, I was able to successfully check for the presence of the custom field:
$ig_filter=get_post_meta($post->ID,'ig',true);
The rest of it has been quite tricky. I’ve found an old plugin named ‘Custom Image CSS Classes’, but It doesn’t let me reuse the same image, in different pages, with different CSS classes.
I’m not a programmer, but I looked at the code anyways. Although I can understand a bit of what the different functions do, I’m far from understanding it all or be able to adapt it.
Can someone give me a help with this and/or point me in the right direction? Thanks!
- The topic ‘how to append a CSS class to the feature image, per page, using custom fields?’ is closed to new replies.