try this
$second_query = new WP_Query( $args );
if ( $second_query->have_posts() ):
while( $second_query->have_posts() ) : $second_query->the_post();
$attachment_id = get_field('image');
$size = "customfeatins"; // (thumbnail, medium, large, full or custom size)
$my_image = wp_get_attachment_image_src( $attachment_id, $size );
if (!my_image !== ''){
$image = $my_image[0];
} else {
$image="http://domain/image_source/your_image.jpg";
}
endif;
echo '<article>
<img src="' . $image . '" alt="' . get_the_title() .'" width="136" height="90" />
<h3>' . get_the_title() .'</h3>
<p class="date">' . get_the_date() .'</p>
</article>
';
endwhile;
endif;
Related Posts:
- WP 4.4. responsive images browser choosing the “wrong” one
- Remove images (files) that were generated when using add_image_size()
- Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress
- Using Images in WordPress – Best Practices
- How can I determine if a post has an image attachment?
- Change html structure of all img tags in WordPress
- How to create thumbnails with a fixed width, so all of them will have the same width?
- Creating a rotating header /image slider using theme customization
- Adding HTML within an image title attribute
- How do I delete thousands of unattached images?
- How to remove link from an image in a post?
- Change html structure of all img tags in WordPress
- Limit author image size
- Setup A Default Featured Image
- Check if page/post has any anchors that link to an image jpg/gif/png
- What’s the best “insert all images” plugin?
- Any way to “combine” galleries or show multiple galleries as one?
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- Remove image classes from post thumbnail output
- How can I make all post image uploads have data-width and data-height attributes automatically by default?
- Photography Based Design – Multiple Images Per Post
- alt tags of the images are not saving/emtpy
- wp_upload_bits does not retrieve images that do not have an extension
- Get ALT attribute from title post (code not work)
- Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1
- How to check for images before echo
- Can you check if a post WYSIWYG field has an image in it?
- Remove height attribute from wp_get_attachment
- Images give 404 after changing default domain
- Need custom picture field for pages
- NextGEN Conditional Statement [closed]
- Alt Image WordPress [closed]
- Disable save as image on smartphones using all browsers ( chrome, firefox, ie, cm, opera )
- Apply nextgen-gallery lightbox effect [closed]
- How to pass on a value as parameter via url to another page
- How to make image uploads default to full size?
- WordPress 404 Images – Images not found after deleted from media
- Alt attribute is not showing while the value is given in Media
- WooCommerce Variation Swatches and Photos – get attribute thumbnail
- Get “Image CSS Class” value from the Advanced Options section
- Unable to delete images in Media Library
- Dinamically modifying attributes of images on posts
- Best Method to Switch Between Terms (Custom Taxonomy)
- Image to only show up in the single post page, not on the blog/home page
- How to add multiple images in a page
- Only User Upload image Http Error
- restrict access to specific urls on a specific period of time
- Remove “align” attribute on images
- Upload button in metabox not working
- Saving a post, content filtering and user levels
- Slider do not add alt attribute. Cant get alt attribute from a media library!
- Why images are disappearing on WordPress web site?
- Img alt tag showing different value then entered
- Featured Image not changing
- Uploaded Media Images on Site
- How do test if a post is a custom post type?
- show hide image script after 4 seconds [closed]
- Restricting users to view only media library items they have uploaded?
- How do I disable responsive images in WP 4.4?
- Filter to remove image dimension attributes?
- How to get a list of all the possible thumbnail sizes set within a theme
- How to get image title/alt attribute?
- How do I get the avatar URL instead of an HTML IMG tag when using get_avatar?
- Image Upload from URL
- Programmatically adding images to media library
- How do I delete all UNUSED images from my uploads directory?
- Set default image sizes in WordPress to hard crop
- Is it possible set a featured image with external image URL
- get attachment title based on attachment id
- Stop wordpress from hardcoding img width and height attributes
- Creating an Image-Centric Custom Post Type?
- Handle issues with change of image scaling (rounding) in 4.1 (WP Ticket #18532)
- Programmatically get images by URL and save in uploads folder
- Prevent WordPress from generating medium_large 768px size of image uploads?
- remove or update add_image_size
- Get Image Description
- How to extend the gallery block in Gutenberg?
- Image quality based on image size
- Function to get URL of original uploaded image – full size
- how to get original image using wp_get_attachment_image_src
- What is a good alternative to using $content_width for image optimization?
- get the attachement url for the medium sized image
- Can I attach image to post without adding it to post?
- Automatically replace original uploaded image with large image size
- WordPress crop tool greyed out
- How to scale up featured post thumbnail?
- Upload images to remote server
- Custom image size / thumbnail – Crop to aspect ratio even when source image is smaller than set dimensions
- Each custom image size in custom upload directory?
- Getting Images from theme’s directory in pages
- Set default image link target in Gutenberg image block
- Add an alignment option for images
- How to delete resized (cropped) image uploads and prevent future resizing?
- How to automatically add rounded corners to thumbnails?
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- Download an image from a webpage to the default uploads folder
- Add image size where largest possible proportional size is generated
- After Moving a Site to Another Domain, All Images Are Lost
- Prevent WordPress from adding image’ title automatically
- Overide Gallery Default Link to Settings