• This simple code snippet is detecting the first image attached to the post:

    $images = get_posts(
                	array(
                    	'post_type'      => 'attachment',
                    	'post_mime_type' => 'image',
                    	'post_parent'    => $post->ID,
                    	'posts_per_page' => 1,
              		  )
          		 	 );?>
    		wp_get_attachment_image($images[0]->ID );

    It works on any post, except those with a page-builder structure. It seems that Page Builder hides the attached image from the function wp_get _attachment_image

    Any tip?

    Thanks

    Fabio

    https://wordpress.org/plugins/siteorigin-panels/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image attachments don't get detected’ is closed to new replies.