• Resolved xvegax

    (@xvegax)


    Hi guys,

    I am using code like this

    if ( is_tablet() ) {the_post_thumbnail( 'blogbild' );}
    elseif ( is_mobile() ) {the_post_thumbnail( 'blogbildmobil' );}
    else {the_post_thumbnail( 'blogbild' );};

    and

    if ( is_tablet() ) { wp_nav_menu( array('menu' => 'primary' ) ); }
    elseif ( is_mobile() ) { wp_nav_menu( array('menu' => 'mobile' ) ); }
    else { wp_nav_menu( array('menu' => 'primary' ) ); };

    to have two different menus and designs/image sizes shown for desktop/tablets and mobile (phones).

    The problem is, it does not work. I tried with that iPad emulator http://www.alexw.me/ipad2 … but it always shows me the website as mobile version (you can realise that by the small post thumbnails in “Journal” and the missing navigation point “Portfolio” (for mobile on purpose)). If you want to check: ivanschneider com is the address.

    So, is my little bit of code wrong or does the plugin not work with an iPad emular or does the plugin not work at all regarding the tablet detection?

    Thank you in advance, guys.

    https://wordpress.org/plugins/php-browser-detection/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter xvegax

    (@xvegax)

    I made a check with echos like:

    if is_tablet echo tablet yes
    elseif is_mobile mobile yes
    else neither

    It came out: tablet yes. So, the plugin seems to work (partially).

    I just do not understand, why it gets detected as tablet, but sill shows the mobile version (menu with only 5 points instead of 6 and small post_thumbnails at the “Journal”).

    Maybe this helps you helping me? 🙂

    Thread Starter xvegax

    (@xvegax)

    Maybe I will just have to let it checked with an actual tablet/iPad and not emulator only?

    Thread Starter xvegax

    (@xvegax)

    Okay, I think, the emulator did not show
    the content properly. I hope, my code can
    help others, too.

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    I’m glad you got it worked out!

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

The topic ‘Tablets not recognised’ is closed to new replies.