• Resolved Dan Stramer

    (@danstramer)


    Hello
    My site’s layout for pages with a sidebar are 50/50
    So, I added this filter:

    add_filter( 'generate_content_class','ds_equal_columns' );
    
    	function ds_equal_columns() {
    		if (!is_front_page() && !is_page(20) ){
      ?>
      class="content-area grid-parent mobile-grid-100 push-50 grid-50 tablet-push-50 tablet-grid-50"
     <?php }}

    As you can see I added a condition because on the homepage and another page i didn’t want the 50/50 layout but a full page layout.
    SInce checking in the admin “full content” didn’t help (because the grid-50 classes were implemented on the div)
    Is there a better way to go forward? So I can have pages that I do want with a 50/50 layout to be selected via the meta box, and other pages to be full width?
    Thanks,
    Dan

    • This topic was modified 8 years, 7 months ago by Dan Stramer.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Tom

    (@edge22)

    You could use this filter to tell your sidebar to be 50% wide: https://docs.generatepress.com/article/sidebar-widths/

    Then the other classes will adjust automatically.

    Let me know if you need more info 🙂

    Thread Starter Dan Stramer

    (@danstramer)

    Thanks Tom,
    So the “return” on the filter is the value of the grid added to the css?
    and all the other corresponding values?
    grid-50 tablet-grid-50 mobile-grid-100 grid-parent sidebar pull-50 tablet-pull-50

    And the content would adjust accordingly?

    So in my case adding this filter:

    add_filter( 'generate_left_sidebar_width','tu_custom_left_sidebar_width' );
    function tu_custom_left_sidebar_width( $width ) {
            // If we're on a category
    	
    		return 50;
    	
    	 // Return the default
    	return $width;
    }

    And if I select a ‘full-width’ page from the metabox in the page editing pane – will it override this setting? Since I would like to have some ‘full-width’ pages.

    Thanks again for your help,
    Dan

    Thread Starter Dan Stramer

    (@danstramer)

    Hi Tom,
    I just checked it out now and it’s working as expected.
    It’s my first time using generatepress and the unsemantic framework – it’s working great!

    Thanks
    Dan

    Theme Author Tom

    (@edge22)

    Great to hear! Glad I could help 🙂

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

The topic ‘content and sidebar width’ is closed to new replies.