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
- What does exactly GPL license mean for my WordPress theme?
- WordPress API Menu/Submenu Order
- How to set thumbnail image for a (child) theme
- What WP folder can I use to write files to?
- Categorising themes by folders in backend
- Best practice (forward compatibility) for theme options
- Custom Upload Panel in Menu Bar
- WordPress themes under GPL license
- How to remove header image on subpages in Twenty Eleven (default theme)?
- Can I update themes without enabling maintenance mode?
- Display a specific dynamic sidebar widgets on a specific page
- How to remove background image from post navigation elements?
- Child theme Page Template not loading
- How to merge two WordPress themes?
- WordPress themes that are browser tested and maintained?
- Browser back button does not work on firefox and safari [closed]
- How to enqueue javascript for WP Customize options sidebar?
- Customizing page content layout
- GPL and intellectual or exclusive ownership
- How to deactivate the text, that appears, when you hovering over topbar tabs? [closed]
- WordPress root directory change + Theme directory change
- How do I understand which page of my theme is being loaded?
- Creating a child-theme: CSS not loading
- The style.css stylesheet doesn’t contain a valid theme header. what should I do, please?
- How to override / customize existing Widgets?
- Download Themes From LocalHost WordPress Site [closed]
- Access to font not allowed by CORS Policy
- Understanding wp_enqueue_style
- Send data to Editor before saving the post
- Trim Post Content on Home Page
- Does Jetpack store comments in local database also? [closed]
- WordPress Theme Breaking on Migration to Live Site [closed]
- Looking for a theme to show unread/updated posts since last visit or like that
- Twenty Eleven NOT valid
- Query for all themes?
- First click to blog title does not open the blog article
- Trying to revive an old wordpress site, but newer versions of wordpress install a different db structure
- Theme translation not working
- How to change allowed attachment files extensions
- Custom homepage with recent blog posts
- Transfer WordPress site to another domain
- Why Underscores Theme Comment Form Reversed?
- Firebug and Chrome rendering two body tags
- Does WordPress provide themes_api function?
- How to show tags in posts with a theme that does not do it
- How can i limit wordpress post title characters in sidebar?
- Site is setup statically – how to make it content managable?
- Theme making direct ajax calls to theme folder
- How to add sidebar to homepage programmatically?
- How to remove header “ish” label [closed]
- Can i Remove copyright text wordpress.org theme
- Disabling Full Site Editor (FSE)