Just wrap you code up in a conditional:
if ( $GLOBALS['is_iphone'] )
{
// do funky stuff for mini screens
}
global $is_iphone;
will trigger TRUE
for all mobile devices incl. tablets.
Edit for WP 3.4+
Now there’s wp_is_mobile()
to make checks for User-Agent
. It’s basically a wrapper for $is_iphone
and does the same.
Related Posts:
- How Do I Use A Custom Mobile Theme?
- Best practices for a Style/CSS based theme options page?
- How to use media upload on theme option page?
- Add a page outside of the current theme?
- Load a theme based on browser detection
- Switch Theme Through Options Panel
- How to make alert for new version on theme options?
- How to mark an option as selected
- Switch to other theme at URL
- How can I show more than 15 themes at a time in the admin menu?
- How to go about pre generating css file with variables from theme options
- Does uninstalling a WordPress theme delete its database values?
- Cannot find the code for “Edit This” link in posts in a specific theme
- Defining different theme for Blog posts page
- Use a different template/theme if mobile only on home page
- Disable Theme API / Front end (for API only environment)
- What’s the proper way to include inlined javascript-source?
- How to understand a specific bit of WordPress syntax
- Should a child theme share the same theme options row as the parent, or should it have it’s own options row?
- Creating a theme options page
- How can I make some themes usable only by admins?
- Custom options below pages/posts editor?
- Mobile issue – website isn’t properly detecting screen size [closed]
- Redux callback action
- Preserve theme settings when migrating from local to live
- Functions containing parameter ‘yourtheme’
- What is the “pub” theme? [closed]
- Jetpack CSS .screen-reader-text breaks mobile menu [closed]
- Passing dynamic options from backend to frontend
- Color Options from Theme Customizer API not returning via get_theme_mod()
- Issue with theme mod options during domain migration
- .PO file is found but I don’t see translations: how to debug the problem?
- How to add some php code in header.php using plugin
- WordPress activate theme error $pagenow
- Setting a new default template for the creation of a page
- Conditional config WP_HOME/WP_SITEURL does not update bloginfo(‘template_url’)?
- Adding a template in WPTouch
- Cannot update a file for my theme
- Blackberry mobile theme redirection
- List of categories instead of dropdown menu selector in admin options
- Switching among theme customizations
- how to create a section inside a section with theme options customizer
- Warning: call_user_func() expects parameter 1 to be a valid callback
- Mobile theme switching problems
- Plugin to load theme if mobile and specific page
- Any Mobile Theme Switcher – Theme not complete (Stylesheet missing)
- Create /archive page in WordPress Theme
- Church hope them issue
- Is there a way to enable horizontal margin for a specific block element?
- How to change background color in the Notepad++ text editor?
- How to change or add theme to Android Studio?
- WordPress frameworks and parent themes [closed]
- Opinions and recommendations on the best barebones base theme [closed]
- Remove JSON API links in header html
- Using OOP in themes
- Where can I download WordPress themes from? [closed]
- Disable plugin / plugin action via theme
- How can I allow the Editor Role to change Theme Settings?
- What are all the available parameters for query_posts?
- Customizing a WordPress theme without changing it?
- Where can I learn to create my own theme?
- How do I turn off self-closing tags for markup in WordPress (for HTML5, or HTML4, for example)?
- how to add version of style.css in wordpress
- Does WordPress work without a theme?
- What is the role and history of the $content_width global variable?
- Adding admin-ajax.php to the frontend. Good or bad idea?
- How to move the sidebar in TwentyFifteen to the right?
- How to Link External jQuery/Javascript files with WordPress
- Installation failed: Download failed. No working transports found
- What is theme-compat?
- Override parent theme translation on child theme
- WordPress Theme activation hook?
- Can wordpress theme folder name be changed freely and nothing technically happens
- Link to specific Customizer section
- What does exactly GPL license mean for my WordPress theme?
- Am I allowed to license my WordPress theme under the aGPL
- WordPress API Menu/Submenu Order
- How do I change the header image height in Twenty Seventeen?
- Starter Theme vs Parent Theme? Pros and cons
- How to change the language for the front-end only?
- W3 Total Cache, CDN and theme files [closed]
- Best way to include Bootstrap in WordPress
- How to set thumbnail image for a (child) theme
- Different template of products for specific category. WooCommerce
- Show different theme for admin?
- How can I version the main CSS file?
- what the best way to include images from the template’s images folder?
- Is it OK to remove theme credits from footer? [duplicate]
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- How can I get the title attribute from get_the_post_thumbnail()?
- Dash or underscore in theme folder name?
- No “Add New” Button. How to add new theme?
- How do I add support to my theme for custom menus?
- “Unexpected error” on update requests
- How to prevent plugin, theme installation failures on WordPress?
- How do I white label my self-hosted site created by wordpress?
- Do Child-Themes automatically load the Translation from the Parent-Theme?
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- How To Add New Option Types To Option Tree?
- What WP folder can I use to write files to?