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
- Separate Media Library for each user
- Maintaining image color and quality when uploading using custom sizes
- Bulk edit wordpress images alt and title attributes
- Separate attachment images from post loop
- Why can’t I edit certain images from the WordPress Media library?
- How to add a media with PHP
- Get original image from thumbnail URL
- WordPress url image redirect to the homepage
- Bulk image rotation
- Is there a way to delete images from WordPress media library programmatically?
- Pull Random Attachments With Pagination
- Create custom fields as image uploads [duplicate]
- How to get default image sizes attribute
- Show image crop window on image upload
- Specific image size is being generated without being registered
- Should I not compress my jpeg files before uploading to avoid double compression?
- Generating a certain sized thumbnail on the fly?
- Link listings with image
- Allow users to contribute images to a post
- After Migration, images show up on a preview of the page but not the actual page [closed]
- How to apply image alt descriptions from media library?
- Image upload error?
- Image not showing using a custom function and get_post_meta
- Random home page background images with caption text
- Using different size thumbnails on different parts of my site… with functions.php?
- Pictures randomly replaced by blue question mark
- Post-processing of the image failed
- Get post thumbnail in specific size
- How to skip the creation of landscape thumbnails for an original portrait image
- Why are my button images blurry on mobile screens?
- Text not wrapping properly around image in WordPress Visual Editor [closed]
- How to regularly backup and update WordPress website with lot of images?
- Resize images to match CSS
- Featured image appears in header
- Preventing the image-post problem from ahead (edit: without redirects)
- How to put images into theme from server folder (not from media library)
- How can I stop WP Image Editor upscaling from looking so pixellated?
- How to show images uncropped after uploading?
- add_image_size() width not actually working
- WP_Customize_Image_Control and selecting from library?
- Get a different size of Image thumbnail while working with custom metabox
- Change the avatar ratio?
- WPALLIMPORT Exporting images from repeater field [closed]
- What does WordPress media uploader do to image files on upload?
- Site header logo and parallax image on homepage do not display on iPhone