Hi,
Is there any way to hide certain widgets with CSS when the page is viewed on a mobile device? I have some text boxes on the sidebar that I want to hide when the site is viewed on a mobile device.
Thanks.
Hi,
Is there any way to hide certain widgets with CSS when the page is viewed on a mobile device? I have some text boxes on the sidebar that I want to hide when the site is viewed on a mobile device.
Thanks.
This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.
Hi Yosniel
You could but you’ll need to inspect the page’s code and grab the related ID or class to hide it. So for example to hide the Recent Posts widget on this page here: http://demo.siteorigin.com/vantage/blog/ below 960px I would say:
Thanks Andrew, I got it to work.
Super, glad we could help here.
In wordpress theme (the box) exists the function wp_ismobile() in the vars.php file. I am using this function to hide a post slider,
if you not have the wp_ismobile() function you can copy in the functions.php file:
this is the function.
function wp_is_mobile() {
static $is_mobile;
if ( isset($is_mobile) )
return $is_mobile;
if ( empty($_SERVER[‘HTTP_USER_AGENT’]) ) {
$is_mobile = false;
} elseif ( strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Mobile’) !== false // many mobile devices (all iPhone, iPad, etc.)
|| strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Android’) !== false
|| strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Silk/’) !== false
|| strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Kindle’) !== false
|| strpos($_SERVER[‘HTTP_USER_AGENT’], ‘BlackBerry’) !== false
|| strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Opera Mini’) !== false
|| strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Opera Mobi’) !== false ) {
$is_mobile = true;
} else {
$is_mobile = false;
}
return $is_mobile;
}
Regards
Hi,
You might wanna check Widget Options : https://wordpress.org/plugins/widget-options if you’ll be hiding several widgets on sidebar. Unfortunately this doesn’t fully supported SO Pagebuilder yet. Thanks!
Hi Everyone!
Widget Options plugin : https://wordpress.org/plugins/widget-options/ is now compatible with Pagebuilder by SiteOrigin Plugin! You can now hide widgets on selected devices. Refer to screenshot below. I hope you’ll love the plugin features.
Cheers!