WordPress.org

Ready to get started?Download WordPress

Forums

is_iphone documenation? (15 posts)

  1. clarklab
    Member
    Posted 3 years ago #

    I've been using this conditional for a while now and just stumbled upon a six month old thread where I was talking about it and no one knew what I was talking about.

    I was curious if after all this time if the is_iphone conditional had made it into the codex but I still don't see any mention of it. I've found it amazingly handy and I'm curious why it isn't a more highly touted feature.

    Is WordPress planning some more major mobile advancements and are waiting to pull the trigger? Or is the conditional not ready for prime time? Should I not be using it?

    And while we're on the subject, can we expand it in future versions to be simply is_mobile or is_smartphone? The test already returns true for Android and others, figured we might as well label it as such.

    Anyone else using is_iphone?

  2. clarklab
    Member
    Posted 3 years ago #

    No love for is_iphone?!

  3. Actually, the Codex is contributed to entirely by volunteers. Anyone with a valid support forum account is welcome to login and contribute.

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    is_iphone is only currently being used in relation to wp_login.php and wp-admin\admin-header.php, so perhaps it's not meant for front-end use? I'll see if I can get one of the core devs to drop by with a definitive answer for you.

  5. Mindshare Studios, Inc.
    Member
    Posted 3 years ago #

    Anyone have an update on this?

  6. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What sort of documentation are you wanting?

    Basic use would be as follows:

    global $is_iphone;
    if ( $is_iphone ) {
       // do something if $is_iphone is true
    }
  7. Mindshare Studios, Inc.
    Member
    Posted 3 years ago #

    I understand the usage but I don't want to start relying on something that isn't going to remain accessible in the WP core.

  8. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Why would you assume that this global variable wouldn't remain "accessible" in WP core?

  9. Mindshare Studios, Inc.
    Member
    Posted 3 years ago #

    Um... because its use on the frontend (e.i. in theme development) has not been documented (per esmi's comment above)?

  10. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Just because its use isn't documented in the Codex doesn't mean that a global variable is at risk of becoming "inaccessible".

    There are lots of global variables for which no Codex page has been created. A few that come to mind are $page, $paged, and $pagenow - and I guarantee that none of those is going anywhere, anytime soon.

  11. Mindshare Studios, Inc.
    Member
    Posted 3 years ago #

    Thanks Chip, I get that. So I guess I'm wondering if maybe there should be a page added to the Codex to explain all of the available environmental global variables WordPress supplies. I think these could be very useful for both theme and plugin authors: $is_lynx, $is_IE, $is_iphone, $is_chrome, $is_opera, $is_safari, $is_apache, $is_IIS, etc...

    What do you think?

  12. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What do I think?

    The more documentation, the better! :)

  13. clarklab
    Member
    Posted 3 years ago #

    I shouldn't really admit this but I've been relying on is_iphone for the main mobile detection in my mobile theme for over a year now. I kept meaning to go back and replace it with something more intelligent but it always seemed to get the job done.

    Until recently, when I've started noticing odd holes. The new Firefox build on Android returns false. Sometimes browing in incognito mode on desktop returns true. Tablets technically function as desired but I think I need to start taking resolution in account a little more heavily.

    What do the rest of you guys use for mobile detection?

  14. Mindshare Studios, Inc.
    Member
    Posted 3 years ago #

    I actually have been using a slightly modified version of this method with good results: http://www.richardshepherd.com/projects/php-mobile-detection/

  15. Adrian Wong
    Member
    Posted 3 years ago #

    A plugin I've used is txtu-is-mobile:
    http://wordpress.org/extend/plugins/txtu-is-mobile/

    I've used it to call different stylesheet in the header.
    http://wordpress.org/support/topic/plugin-is_mobile-how-to-add-functions-for-mobile-version?replies=1

    Still waiting for feedback but nothing so far..
    http://wordpress.org/support/topic/mobile-site-version?replies=1

Topic Closed

This topic has been closed to new replies.

About this Topic