Home>Support>How to hide certain widgets on mobile devices

How to hide certain widgets on mobile devices

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.

  1. 8 years, 6 months ago Andrew Misplon Hi, I Work Here

    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:

    @media screen and (max-width: 960px) {
    .widget_recent_entries { display: none; }
    }
  2. 8 years, 6 months ago Yosniel Romero

    Thanks Andrew, I got it to work.

  3. 8 years, 6 months ago Andrew Misplon Hi, I Work Here

    Super, glad we could help here.

  4. 6 years, 8 months ago fxaviergp

    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

  5. 6 years, 2 months ago Jeffrey Carandang

    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!

  6. 6 years, 6 days ago Jeffrey Carandang

    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!

    SiteOrigin Pagebuilder Widget Options

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More