WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My desktop version of wordpress theme requires using a 'static' page as the start page as it has custom shortcodes etc.

While this is good, when it comes to my mobile theme, sadly the 'static' page is being displayed and because its a different theme, the shortcodes are not being executed.

Is there a way to tell a mobile theme to display 'blog posts' as the default page and not use a 'static page' as a starting page for the theme?

share|improve this question
Thanks Kaiser, pardon me, but am I right in assuming that this goes into the mobile theme's header (even before the <head> tag)? – Sledge81 Apr 23 '12 at 16:49
What? Please ask Q on my answer. Thx. – kaiser Apr 24 '12 at 14:23
up vote 3 down vote accepted

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.

share|improve this answer
Is this a built-in WordPress variable? If so, this might be easier than the way I am doing it now (and was going to suggest) which is by including MobileDetect. – Joseph Leedy Apr 23 '12 at 16:48
Yes it is. There'll also be a function wrapper or short API for it with WP 3.4. – kaiser Apr 23 '12 at 17:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.