• I want to remove right sidebar on mobile devices using wp_is_mobile hook, please help me.

    On mobile devices sidebar is looking same as on desktop devices. Want to remove it or bring it down

    Making designrapid.com responsive without using media queries. Plzz help

Viewing 15 replies - 1 through 15 (of 15 total)
  • modify your theme’s sidebar call as per outlined below.

    <?php if (wp_is_mobile() )
    {
    //it is a mobile device, you might want to add something
    }
    else
    {
    //it is not mobile, add your sidebar code here so the sidebar will appear only on big screens.
    }
    ?>

    hope that helps.

    Thread Starter Monty

    (@raman2572)

    I am using genesis framework, your solution is not working.

    If you are using framewrok, you need to hook the above solution so it will append whatever your framework supplies.

    Thread Starter Monty

    (@raman2572)

    I am new to Genesis framework and they are not responding to my issue as it is a custom build design

    Thread Starter Monty

    (@raman2572)

    can I remove sidebar using media queries, trying this, but not successful

    @media screen and (max-width: 800px) {
      #sidebar {
        display: none;
          }
    }
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    We aren’t given access to commercial products so we don’t support them. If you cannot retrieve support from your theme’s vendors then consider switching to a theme we support.

    if your sidebar doesn’t have a lot of ads, it is a better way to do media queries instead of waiting for tech support. ??

    make sure to put your media queries at the bottom of your css file or append your display css to important.(display: none !important;)

    Thread Starter Monty

    (@raman2572)

    I am able to remove sidebar but it is showing blank space.

    if you can post a url, that will be helpful..:D

    Thread Starter Monty

    (@raman2572)

    Monty,
    Did you get this working?

    I am trying this (but haven’t tested it yet…):

    I used the Genesis Simple Hooks plugin, and put this code in the genesis_before_sidebar Hook:

    <?php if (wp_is_mobile() )
    {
    <div style="display:none">
    }
    ?>

    and then this code in the genesis_after_sidebar Hook:

    <?php if (wp_is_mobile() )
    {
    </div>
    }
    ?>

    Not sure if that will do it, but I will test it out later this week.

    Hmm. Doesn’t seem to be working. My sidebar stuff still shows up on mobile devices.

    Anybody have any idea why?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Have you contacted your theme’s vendors about this? Or plugin author? In the Themes and Templates forum your plugin author really has no idea that this thread exists.

    Yeah, but my theme is custom as well, just like the OP and I thought maybe he has figure it out…

    Anyway, I figured it out, so I am posting the solution here for him and for anyone else who needs it:

    I put this in the genesis_before_sidebar_widget_area hook:

    <?php if ( wp_is_mobile() ) : ?>
    <div style="display:none">
    <?php endif; ?>

    And put this in the genesis_after_sidebar_widget_area hook:

    <?php if ( wp_is_mobile() ) : ?>
    </div>
    <?php endif; ?>
    raizen84

    (@raizen84)

    Hi, thanks for sharing this piece of code. I’m new with genesis and i found a solution combining two plugins but i’m interested to integrate it in the code and avoid using plugins. Could you explain to me how i can integrate this php code into genes? Do i need to write it in the functions.php file?

    Many thanks for your help
    vincenzo

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to remove sidebar on mobile devices’ is closed to new replies.