• Resolved zazzou

    (@zazzou)


    Hello !

    I would like to add a class to the image displaying in my articles. I develop with the bootstrap starter theme wordpress.
    I display the featured image in the single page but I would like to add a custom class to this specific image.
    How can I do this ?
    I try to do something with get_image_tag_class but it does not work…
    Thanks for your help

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    It depends on how the img tag gets output by the theme. There might be a filter you can use. For example, ‘post_thumbnail_html’ if the_post_thumbnail() is used.

    Thread Starter zazzou

    (@zazzou)

    Here the class of the image output :

    class=”attachment-custom-image-single size-custom-image-single wp-post-image”

    So how can I use the filter ?

    • This reply was modified 4 years, 7 months ago by zazzou.

    HEY in bootstrap uh want to add or in css
    if in bootstrap then you might try this code
    Responsive image

    and if css can tell me will provide you thats also

    Thread Starter zazzou

    (@zazzou)

    I’m sorry I don’t understand the answer…
    I don’t see the code.

    Thread Starter zazzou

    (@zazzou)

    I find the solution:
    the_post_thumbnail('thumbnail', array('class' => 'your-class-name'));

    Thanks

    • This reply was modified 4 years, 7 months ago by zazzou.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add a class to image single’ is closed to new replies.