Saturday, March 15, 2008

3 Columns : Minima : Two Right Sidebars

Article Series: 3 Column Step by Step Guides

Here are the steps to convert a default 2 column Minima template in to a three column template with two sidebars on the right hand side of the main post area. This conversion will also work on Minima Black, Minima Blue and Minima Ochre.

(If you really want to understand what's happening here, read the article series Three Column Templates Explained.)

1) Add a new CSS id selector for the 2nd sidebar wrapper.

  • Go to Layout -> Edit HTML
  • Locate the #sidebar-wrapper section (Do a Find using your browser)
  • Copy that full section and paste below the existing sidebar section (it doesn't have to be below) and rename it to #sidebar-wrapper-two
  • Change the float: $endSide to float:$startSide of the #sidebar-wrapper section (See the code snippet below)
#sidebar-wrapper {
width: 220px;
float: $startSide;
word-wrap: break-word; /* fix for ... IE */
overflow: hidden; /* fix for long ... float */
}

#sidebar-wrapper-two {
width: 220px;
float: $endSide;
word-wrap: break-word; /* fix for ... IE */
overflow: hidden; /* fix for ... float */
}

2) Introduce a new div element, as a child of the content-wrapper, to be the placeholder for the 2nd sidebar
  • Locate the <div id='sidebar-wrapper'> element.
  • Copy the code shown in red, below that section (this has to be below)

<div id='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar' preferred='yes'>
</b:section>
</div>

<div id='sidebar-wrapper-two'>
<b:section class='sidebar' id='sidebar-two' preferred='yes'/>
</div>

<!-- spacer for skins that want sidebar and main to be the same height-->

3) Expand the width of the other wrappers to accommodate the new sidebar
  • Locate the CSS sections called #outer-wrapper, #header-wrapper and #footer
  • Change their width property to 880 pixels

#outer-wrapper {
width: 880px;
margin: 0 auto;
...
}

#header-wrapper {
width: 880px;
margin: 0 auto 10px;
...
}

#footer {
width: 880px;
clear: both;
margin: 0 auto;
...
}

4) Do necessary adjustments to margins, padding etc
  • Locate the #sidebar-wrapper section
  • Insert a left margin of 12 pixels.

#sidebar-wrapper {
width: 220px;
margin-left:12px;

...
}

5) Adjust the max width of the header description to center it in the new expanded header
  • Locate the #header .description section
  • Change the max-width property to 880 pixels.
#header .description {
...
padding:0 20px 15px;
max-width:880px;
...
}

Note: Step 6 is only needed if your Layout Editor does not show the newly added sidebar. There was an issue where the Firefox browser didn't show a 3 column template fully in the edit mode. But Blogger reports that the issue has been fixed now.

6) Modify the CSS rules for the wire frame layouts editor.
  • Locate the end of the skin denoted by "]]>"
  • Add the following code above that line.

/** Page structure tweaks for layout editor wireframe */

body#layout #outer-wrapper {
padding-top: 0;
width:720px;
}
body#layout #header-wrapper,
body#layout #content-wrapper,
body#layout #footer {
padding: 0;
width:720px;
}

body#layout #main-wrapper {
width:400px;
}

body#layout #sidebar-wrapper,
body#layout #sidebar-wrapper-two {
width:150px;
}

]]></b:skin>

Save the template. Switch to Page Elements view and enjoy your 3 column template!