Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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
1  
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 Apr 23 '12 at 16:48
1  
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

 
discard

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.