Title: Basic Conditional &#8211; Need Help!
Last modified: August 22, 2016

---

# Basic Conditional – Need Help!

 *  [PRCAcct33](https://wordpress.org/support/users/prcacct33/)
 * (@prcacct33)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/)
 * Hello, I am having a lot of trouble implementing a very simple IF/ELSE statement
   with this plugin. I can’t figure out what the problem is, and I’ve tried every
   possible syntax I could think of
 * All I am trying to do is serve one block of content for mobile devices, and an
   alternate block for everything else.
 * <?php if ( is_mobile() ) { ?>
 * Mobile Content
 * <? } else { ?>
 * Wired/Desktop Content
    ?>
 * Any assistance very much appreciated!!
 * [https://wordpress.org/plugins/mobble/](https://wordpress.org/plugins/mobble/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [tanushka](https://wordpress.org/support/users/tanushka/)
 * (@tanushka)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686210)
 * You have not closed the else statement correctly.. see below.
 *     ```
       <?php if ( is_mobile() ) { ?>
   
       Mobile Content
   
       <? } else { ?>
   
       Wired/Desktop Content
       } ?>
       ```
   
 *  Thread Starter [PRCAcct33](https://wordpress.org/support/users/prcacct33/)
 * (@prcacct33)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686309)
 * Thanks – but that’s not the problem; only a typo in my example I’m afraid
 *  Plugin Author [Scott (@scottsweb)](https://wordpress.org/support/users/scottsweb/)
 * (@scottsweb)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686311)
 * What device are you testing on? You may need to check the device you are using
   is correctly identified as mobile here: [http://demo.mobiledetect.net/](http://demo.mobiledetect.net/)
 * If it is correctly detected you may also need to update the mobile detect library
   within the plugin (something I have not done for some time).
 *  [tanushka](https://wordpress.org/support/users/tanushka/)
 * (@tanushka)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686381)
 * This is a correct code and i have tested and works fine..
 *     ```
       <?php if ( is_mobile() ) { ?>
   
       mobile
   
       <?php } else { ?>
   
       no
   
       <?php } ?>
       ```
   
 *  Thread Starter [PRCAcct33](https://wordpress.org/support/users/prcacct33/)
 * (@prcacct33)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686394)
 * It is an iPhone 6 running iOS8. I’ve setup the conditional as it appears above,
   but the browser on both my desktop computer AND mobile device seems just to ignore
   the conditional and display all of the content.
 *  Plugin Author [Scott (@scottsweb)](https://wordpress.org/support/users/scottsweb/)
 * (@scottsweb)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686444)
 * mobble relies on a PHP library called mobile detect ([http://mobiledetect.net/](http://mobiledetect.net/))
   and it may need updating to reflect new devices.
 * Can you try downloading the latest version of mobile detect and replacing it 
   with the one in mobble (mobile-detect.php) and post back if it works for you.
 *  [jarth3000](https://wordpress.org/support/users/jarth3000/)
 * (@jarth3000)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686513)
 * I’m actually having the same issue with conditional statements.
 * It’s weird.
 * <?php if ( is_mobile() ) { ?>
 * mobile
 * <?php } else { ?>
 * no
 * <?php } ?>
 * If I set the code up like that, it shows on mobile, desktop, everywhere, the 
   content in the else statement but won’t recognize the mobile statement.
 * Any ideas?
 * This is cross browser, cross platform. It’s the weirdest damned thing.
 *  Plugin Author [Scott (@scottsweb)](https://wordpress.org/support/users/scottsweb/)
 * (@scottsweb)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686514)
 * It sounds like your site is most likely being cached. So your first visit (on
   desktop) is being remembered for subsequent visits on mobile and by other visitors.
   Some cache plugins can be configured to work but it really depends on how your
   site and server are setup.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Basic Conditional – Need Help!’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mobble_f5f5f5.svg)
 * [mobble](https://wordpress.org/plugins/mobble/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mobble/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mobble/)
 * [Active Topics](https://wordpress.org/support/plugin/mobble/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mobble/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mobble/reviews/)

 * 8 replies
 * 4 participants
 * Last reply from: [Scott (@scottsweb)](https://wordpress.org/support/users/scottsweb/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/basic-conditional-need-help/#post-5686514)
 * Status: not resolved