• Resolved jwqchen

    (@jwqchen)


    Currently when the sidebar is empty, generatePress puts in some default filler widgets to fill the empty space. With the increasing use of context aware widgets, it would be nice to have the option to hide the sidebar completely when it is empty.

    Example use case: I use a plugin that displays widgets at a large screen size and hides all widgets at a small screen size. Currently with GeneratePress, in the small screen size the default filler widgets would display. That is not the desired behavior.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    This should be achievable with a pretty simple filter:

    add_filter( 'generate_sidebar_layout', function( $layout ) {
        if ( ! is_active_sidebar( 'right-sidebar' ) ) {
            return 'no-sidebar';
        }
    
        return $layout;
    } );

    Let me know if that helps or not 🙂

    Thread Starter jwqchen

    (@jwqchen)

    That worked like a charm. Thank you!

    Theme Author Tom

    (@edge22)

    You’re welcome 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Feature request: hide sidebar automatically when it is empty’ is closed to new replies.