Site logo

Archived topic

Sidebar on mobile

4 replies · Started by Den on December 30, 2021

Viewing posts 1–5 of 5

Hello team,

I want to remove both sidebars on mobile. (But not by using CSS) I don't just want to hide. I want to completely remove it in order to maintain the page load speed.

Please help me out. I always get amazing support from you guys.

Waiting for your reply.

Hi Den,

You can also try this:

1. Go to appearance > elements, create a layout element, chooseContent (no sidebars), select locations depending on your needs.

2. Add this PHP snippet:

add_filter( 'generate_element_display', function( $display, $element_id ) {
    if ( !wp_is_mobile() && 2134=== $element_id) { 
        $display = false;
    }

    return $display;
}, 10, 2 );

Replace 2134 with your element ID which can be found at the element editor URL:
https://www.screencast.com/t/ylB1XTQtvF

I have many other memberships but the support I get from you guys (Generatepress) is topnotch.

Thank you so much, Leo and Ying. and Happy New Year !

You are welcome Den!

Happy new year :)

This archived topic is closed to new replies.