Determine if get_the_image has image on Get the image Plugin

is there a way / function to determine if Get the image plugin successfully grab the image from post? Something like has_post_thumbnail on WordPress featured image. I need to know if featured image exist, since other HTML elements (position absolute) / depend on the Featured image for positioning.

Thanks.

Topic post-thumbnails images plugins Wordpress

Category Web


You can just run a conditional check on the result of get_the_image(). Either it will have returned an image or not.

if ( function_exists( 'get_the_image' ) ) {
  $image = get_the_image(array('echo'=>false));
  if( ! empty ( $image ) ) {
     // do something with the image

  } else {
     // do something if there is no image

  }

}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.