Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Tablet sidebar

  • Hi,

    I’ve just made my site go live with GP after having it in staging.

    Everything looks great, very happy with GP.

    There’s just one thing I need to fix – the sidebar on desktop looks perfect, but there’s a very thin sidebar appearing on tablet when it’s held horizontally and then when the tablet is held vertically the content all goes tight to the left side of the screen and there’s a large white gap on the right side.

    I’d like to remove the sidebar completely from tablet both orientations, and have the content just appear in the center with small padding to each side.

    I have this CSS in Customizer:

    @media(max-width: 1024px) {
    #right-sidebar, #left-sidebar {
    display: none;
    }
    }

    Can I update that to have the sidebar removed completely from tablet, but without removing it from desktop devices please?

    Thanks very much,
    Mark

  • Hi Mark,

    what about mobile? do you need the sidebars?

    And can you link us to your site where we can see the sidebars?

  • Hi Ying,

    I’d like the sidebar to only appear on desktop, not tablet and not mobile (either vertical or horizontal).

    Site is wherearethosemorgans.com

    Thanks very much!
    Mark

  • Try this PHP code:

    add_filter( 'generate_sidebar_layout', function( $layout ) {
        // If we are viewing on mobile/tablet devices, set it to no sidebar
        if (wp_is_mobile() ) {
            return 'no-sidebar';
        }
    
        // Or else, set the regular layout
        return $layout;
     } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.