• Resolved brian914

    (@brian914)


    I am using wp_get_attachment_image() to retrive one of my images, but would like to be able to add a different class to the image. Right now, I am getting this:

    <img class="attachment-full" width="230" height="160" title="thumb" alt="thumb" src="https://localhost:8888/agilitygraphics/wp-content/uploads/2011/05/agility.jpg">

    So instead of the “attachment-full” I want to either add another class, or one instead.

    How can I do that?

    Thanks a lot for any help with this!

Viewing 1 replies (of 1 total)
  • Thread Starter brian914

    (@brian914)

    I figured it out and did something like the following:

    $imageUrl = wp_get_attachment_image_src( $attachment->ID, ‘full’ );

    echo ‘<img class=”myCustomClass” src=”‘; echo $imageUrl[0]; echo ‘”/> ‘;

Viewing 1 replies (of 1 total)
  • The topic ‘wp_get_attachment_image change class’ is closed to new replies.