July 30th, 2015 at 08:52 #32399Rufus McDufus
Hi – I’m using Mantra with 2 colums – body plus right hand sidebar. With the responsive theme set I find I lose the sidebar on tablets – specifically my iPad Air 1 with Safari. The screen resolution is 2048×1536 so ample to support the sidebar.
I can see in theme-functions.php that there’s a user agent check and it matches several strings in the user agent – ‘mobile’ && ‘ipad’.
Here’s the match line in theme-functions.php:
$browser = $_SERVER[‘HTTP_USER_AGENT’];
$keys = ‘mobile|android|mobi|tablet|ipad|opera mini|series 60|s60|blackberry’;
if (preg_match(“/($keys)/i”,$browser)): $classes = ‘mobile’; endif; // mobile browser detected
[There’s also a match on ‘android’ and I’m guessing there’s likely to be an even greater spread of screen resolutions.]
Here’s my iPad user agent:
“Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3”
It looks as if there’s a match and thus a mobile device is detected then the sidebar gets dropped altogether.
Now of course different iPads have different resolutions. Would a better method be to match on resolution, or is that not possible?
The topic ‘Responsive theme and iPad/tablets’ is closed to new replies.