WordPress.org

Support

Support » Plugins and Hacks » Remove Image Width and Height Attributes

Remove Image Width and Height Attributes

Viewing 4 replies - 1 through 4 (of 4 total)
  • Use kd_mfi_get_featured_image_url instead of kd_mfi_get_featured_image and put it in your own img tag.

    <img src="<?php echo kd_mfi_get_featured_image_url( 'featured-image-2', 'post', 'full' ); ?>" />

    vikkineal
    Member

    @vikkineal

    ^^ Thanks for the above solution – it does work. However, how would i write it so that the images only display IF they exist? For example, I have 5 featured images in my admin, but have currently only added 3 – yet the img tag for 4/5 still appears in my HTML.

    Eric
    Member

    @ericsusprodcom

    vikkineal, here is what you need

    <?php
        // if plugin exists
        if(class_exists('kdMultipleFeaturedImages')):
          // insert entire image
          kd_mfi_the_featured_image('featured-image-2', 'post');
        endif;
    ?>

    or alternatively you can call just the image like you wanted

    <?php
        // if plugin exists
        if(class_exists('kdMultipleFeaturedImages')):
          // insert entire image
          ?>
              <img src="<?php echo kd_mfi_get_featured_image_url( 'featured-image-2', 'post', 'full' ); ?>" />
          <?php
        endif;
    ?>
    vikkineal
    Member

    @vikkineal

    Sorry – for some reason I hadn’t seen your reply!

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Image Width and Height Attributes’ is closed to new replies.