WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Featured Images
Remove Image Width and Height Attributes (5 posts)

  1. burciaga
    Member
    Posted 1 year ago #

    Hello, I am working on a responsive site and I am using the Multiple Featured Image plugin and it is placing the width and height in the HTML output. How can that be removed so I can make the image responsive?

    http://wordpress.org/extend/plugins/multiple-featured-images/

  2. Bangbay Siboliban
    Member
    Posted 1 year ago #

    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' ); ?>" />

  3. vikkineal
    Member
    Posted 1 year ago #

    ^^ 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.

  4. Eric
    Member
    Posted 11 months ago #

    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;
    ?>
  5. vikkineal
    Member
    Posted 10 months ago #

    Sorry - for some reason I hadn't seen your reply!

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.