WordPress wp_is_mobile() can be the function that you’re looking for.
// Use the build-in function if WP
if(wp_is_mobile()) // On mobile
{
the_post_thumbnail_url('featured-image-mobile');
}
else
{
the_post_thumbnail_url('featured-image');
}
Related Posts:
- How do I disable responsive images in WP 4.4?
- WP 4.4. responsive images browser choosing the “wrong” one
- How to insert pictures without hard coded dimensions?
- Making WordPress Gallery (.gallery-item) Responsive?
- WP 4.4 aspect ratio with responsive image
- How can I serve different images depending on screen size with wordpress
- How to Make WordPress Default gallery responsive on mobile?
- Responsive background images added inline
- Responsive Images – Add srcset attributes to custom Images Function
- Get a list of all image sizes that match aspect ratio of original one
- How to exclude an image size from the WordPress srcset
- Responsive Images Resizing Images
- Featured image (responsive) above content is too small after update to WordPress 4.4
- WP Responsive images – upload custom image sizes
- Fuzzy Images in WordPress 4.4
- Removing height and width from images with a caption
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- Multiple amp-image overlays. How to properly do this in wordpress?
- Fallback for missing srcset images
- max_srcset_image_width doesn’t work as intended
- Using SRCSET with Images and Featured Images
- Understanding WordPress image sizes and responsive images
- Custom responsive ‘featured image’ sizes
- One of my image sizes isn’t showing up in srcset
- How to stop WordPress from completely overriding my tags in my templates?
- Adding srcset to an image in ajax
- the_content not showing responsive image attributes srcset or sizes
- Serve different images per screen size and cache possible?
- Disable Media File Image Link On Mobile Devices
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- Why does WordPress list all image sizes in srcset even if they’re larger?
- Responsive header image
- What’s are some best practices for responsive images (e.g. for section headers)?
- WordPress Responsive Image ( srcset ) not work properly
- Responsive Images – Defining
- Decide how Hero image appears on mobile
- Responsive Featured Images Not Working
- Responsive images with srcset
- Getting extra image links in code with wp_get_attachment_image
- built-in responsive images in content – do I need to add anything to functions.php?
- Responsive images in Bootstrap 4 slider
- WordPress not choosing the right image from srcset
- Responsive Images in WordPress
- Is there a good way to use CMS images with CSS
- Remove one srcset entry from wp_get_attachment_image
- Generate / attach Image srcsets from ACF Image Field
- Remove srcset thumbnail attribute for products in the WooCommerce shopping cart
- wp_get_attachment_image with custom size not rendering possible 2x srcset image
- medium_large image size not displaying properly on the frontend?
- Handle issues with change of image scaling (rounding) in 4.1 (WP Ticket #18532)
- Allow contributor role to upload images and not edit already published articles
- Width 100%: Aspect ratio of image
- Upload images using FTP and show them in media
- Why does wordpress generate more thumbnails than the 3 standard sizes?
- Link Featured Thumb to Attachment Page, If Possible
- Is there a shortcut to change bulk BMP images to JPG images in a site?
- WordPress Post featured image URL in the header
- HTTP Error when uploading files above 7mb unless using GD Image Editor
- Image popup in a lightbox / overlay from the backend 3.5 admin area (plugin)
- Auto resize images after adding a new size
- media sideload image and Google Content
- Big Image on Featured Post, Normal on Single Post
- Making images in posts link to the image file rather than the attachment page
- offload media to external services [closed]
- How to filter the image embed code based on link type
- Retain the original name of the image on resize
- Retrieve image from content, assign it as a featured, and then remove it from the content
- Custom Loop, Match Category with Page: How to display post featured image?
- Modifying the HTML Output of Inserted Images
- Google verification challenge with file location
- Remove height attribute from wp_get_attachment
- How do I retrieve an image’s width and height using Advanced Custom Fields?
- wp get attachment image always gives me thumbnail
- Images are not showing after moving WordPress installation from server to localhost?
- Images are not showing up in “Uploaded to this post”
- Cache DB queries result
- Remove “%” from strings in serialized arrays in wp_postmeta
- Images not found after migrating WordPress website
- Error uploading images in wordpress
- Set two default featured images
- Automatically generate missing images
- Apply nextgen-gallery lightbox effect [closed]
- Page speed error: “serve scaled images”
- How can i sorting and display image order by siz in media library?
- x2 images for retina?
- Load url image full size in thumbnail, medium, large size
- WordPress can’t detect any thumbnails size?
- Remove image border in twentyeleven theme [closed]
- 403 Forbidden when accessing image in wordpress
- For what does WP generate Thumbnails?
- Images are not shown
- Adding multiple images on my site – without using plugins [closed]
- Remove the height limit on wordpress 3.4.2
- Image media upload problem in page editing modus?
- Upload image from other server without resize?
- where is images/image.jpg?
- Using the on-board image editor for featured images: edits are not being used
- What type to upload image within theme options?
- Replace image with its alt text?
- How to disable featured image from inside of the blog post?