WordPress does have a helper function for detecting mobile devices, wp_is_mobile()
(untested):
if ( ! wp_is_mobile() ) {
echo do_shortcode( '[meta_gallery_slider arrows="false" show_caption="false" show_title="false" autoplay="false" slider_height="450"]' );
}
As Jacob Peattie mentioned, this is unreliable. Better option is to use CSS to show the output only for viewport widths above specified value (untested):
PHP:
printf(
'<div class="hide-if-mobile">%s</div>',
do_shortcode( '[meta_gallery_slider arrows="false" show_caption="false" show_title="false" autoplay="false" slider_height="450"]' )
);
CSS:
@media ( max-width: 768px ) {
.hide-if-mobile { display: none; }
}
Related Posts:
- Disable plugin / plugin action via theme
- Changing wp login url without .htaccess
- Simple form that saves to database
- Does wordpress have a post hit counter?
- Get Current user email as a return string value
- How can I make content disappear when a user logs in?
- Adding New Role
- ‘Lazy loading’ list of posts with pagination
- Get subcategories with JSON API plugin
- Custom url structure for custom template
- WooCommerce plugin appearance and look [closed]
- ID Conditional User Contact Methods Not Saving
- Replace existing pages with new pages, keep menu links
- New Plugin: Post update pushes a copy as a revision
- New post notification plugin [closed]
- Exporting and importing my WordPress database, but none of the plugin settings are importing
- Plugin for gallery with thumbnails?
- Adding Plugin-specific Fields with wp_insert_post()?
- How to get the “stats” plugin that comes with a .wordpress.com blog?
- Woocommerce – How to populate custom select field with stored values on checkout page?
- How to create ‘import dummy data’ option in custom wordpress plugin
- Missing Argument
- Adding Shortcode to Text Widget
- W3 Total cache “empty all caches” and no stylesheets render [closed]
- Woocommerce pagination problem
- How to use site_url() in Elementor [closed]
- wp_generate_attachment_metadata is creating an empty array
- How to toggle between two custom fields in WordPress woocommerce ‘WC Product Field Group’ plugin?
- What are the specifics of WordPress development I need to know? [closed]
- Use of Templates in a Plugin
- Insert data from .sql file in wordpress plugin
- get_post_title is not working on homepage
- Redux Framework: Page freezes on typing in Editor
- Import sql data from a large file when installing plugin
- Jquery NoConflict Problem
- When taxes are country specific they don’t show in the cart totals
- How to replace website?
- changes to header.php not appearing
- List out all the plugins on WordPress instance
- Can WordPress Drop-ins be given their own directory?
- Can my hooked uninstall class function access a global var declared in main plugin file?
- Flag Comment as inappropriate button plugin
- How can I add IP address to my post?
- serverSideRender does not render “preview” html inside Gutenberg block
- Remove Pagination for Product Category Pages WooCommerce
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- How to add/change (woocommerce) product tab icon
- Get post content from outside the loop with plugin shortcode usability
- Adding option values as an array using a multi selectable select box
- WordPress plugin database. How to create table for checkbox
- How to set the default value as the saved value once a form of widget is saved?
- Custom post type change excerpt more and excerpt length
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- Advanced custom fields and Slideshow gallery desn’t work together? [closed]
- How can I show registration form inside modal?
- Replace video url with video player
- Order posts of a custom post type by the event date using FT Calendar Plugin
- Is it save to replace with in WordPress search form
- How could I fix the lowercase problem in nextgen gallery? [closed]
- Publishing a video from blog to youtube
- Custom Logo Link WordPress
- Where do I put the code snippets I found here or somewhere else on the web?
- Is it possible to pin a post in second position from top
- admin_notices show after load completed
- Error in Fetching Custom Post Type parent Category URL (slug)
- Changing the Default New User Notification Email
- WP Fastest Cache -> Render Blocking Js -> Exclude Js Sources
- function post to trash problem
- How to call function in WordPress on button click?
- How to add a “Who’s who” on a wordpress blog post?
- How can I see $post object in frontend from functions.php?
- WordPress site hamburger menu toggle not working
- Move plugin pages from dashboard to front-end
- save short-code in my custom plugin settings problem missed something
- WordPress website working fine on localhost but not displaying front pages on webhost
- Change WordPress plugin widget `id_base` without breaking widget
- Uploading website to live causing problems to plug-in and layout
- How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page’s content as given example?
- Capture Recaptcha fail event on Contact Form 7
- register_activation_hook not creating table
- How can I share my wordpress site with a friend?
- Making sure updates didn’t break anything
- how to send two forms with one click (script ninjaforms id)
- wp_schedule_event function reference
- Meta box or shortcode help
- Users Ultra: Hide asterisk for required registration fields?
- Adding HTML to the search page
- How to retrieve hashtaged tweets from a list of users and post to WordPress
- Using a Cron Job to dynamically populate a field ONCE, and then making the field blank the next time someone visits page
- Custom Function for SEO by Yoast plugin
- Custom feed parameters / Template overriding
- Turning Existing Eccommerce Site into Multi-SIte
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- post_exists() returns a 0 but the 0 doesn’t register [closed]
- Display HTML5 jQuery Audio Player On Front Page
- How Do I Add Product Pictures To Search Results Of A Custom WordPress Theme Using A WooCommerce
- Is it possible to add permalink when using wp_insert_post?
- Update Plugin of wordpress to specific version
- Can WordPress updates take down site functions?
- How to get custom setting from get_option and pass it in getEntityRecords in gutenberg block?