This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

How to hide certain widgets on mobile devices

Resolved 6 replies premiumthemetheme-vantage
11 years ago · Last reply by Jeffrey Carandang 9 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

6
  1. Andrew Misplon Staff 11 years, 9 months ago

    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. Yosniel Romero 11 years, 9 months ago

    Thanks Andrew, I got it to work.

  3. Andrew Misplon Staff 11 years, 9 months ago

    Super, glad we could help here.

  4. fxaviergp 9 years, 11 months ago

    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. Jeffrey Carandang 9 years, 5 months ago

    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. Jeffrey Carandang 9 years, 3 months ago

    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.

Have a different question or issue?

Start New Thread