• Hello. I’m wondering if there is a way to change the size of the left sidebar and main content areas on specific pages only using my child theme custom css.

    I am wanting to make the sidebar 75% of the original size (or 25% smaller) and add that 25% to the main content area making it 125% of original size. I want to do this on only 5 pages and not the rest of the website that also uses left sidebars.

    Any help would be greatly appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dsb0328

    (@dsb0328)

    So, Im guessing there is no way to do this?

    Well you can use this:
    http://presscustomizr.com/snippet/changing-the-global-column-layout-of-the-customizr-theme/

    Basically you can do something like:

    add_filter('tc_global_layout', 'my_custom_layout' );
    function my_custom_layout( $layout ) {
      $my_layout      = array(
            'l' => array ('content' => 'span10' , 'sidebar' => 'span2'),//sidebar on the left
      );
    
      //fill this with your 5 page ids
      $pages = array(
            //page_id
            '1',
            '7',
            '41'
      );
      if ( is_page($pages) ){
        //sets new values for content and sidebar (checks if there are new values to set first)
        foreach ($layout as $key => $value) {
            $layout[$key]['content']   = isset( $my_layout[$key]['content']) ? $my_layout[$key]['content'] : $layout[$key]['content'];
            $layout[$key]['sidebar']   = isset( $my_layout[$key]['sidebar']) ? $my_layout[$key]['sidebar'] : $layout[$key]['sidebar'];
        }
      }
      return $layout;
    }

    Thread Starter dsb0328

    (@dsb0328)

    Thanks d4z_c0nf. Looks a bit foreign to me at first, but I’ll look into this and see if I can make any sense out of it.

    I see,
    well just add that code to your child-theme functions.php.
    And fill the $pages array with the page ids you want.
    To get the page ids go in your dashboard -> Pages, but you can also fill that array with the names of your pages, or the slugs, like:

    $pages = array(
            //page_id|slug|name
            '1',
            'Page1',
            'page2'
      );

    https://codex.wordpress.org/Function_Reference/is_page

    Thread Starter dsb0328

    (@dsb0328)

    That is so helpful. Thank you and I will let you know if it works for sure.

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

The topic ‘Left Sidebar Width on Specific Pages…’ is closed to new replies.