WordPressTheme /

Customizing Sans-serif Racer

Sans-serif Racer









How to make it a 2 column theme with a more narrow sidebar?

  1. Open theme's index.php or Main Index Template file from the right sidebar in Presentation > Theme Editor. Scroll to the bottom of its content and inside <div id="content-sub"> you will see:
    <div id="content-sub" class="bb-t12 bb-fc">
    <div class="bbin-a1">
      <div class="bb-tbase">
        <?php dynamic_sidebar('sidebar-default'); ?>
      </div>

      <div class="bb-tbase">
        <div class="bb-t13 bb-fa"><div class="bbin-c1">
          <?php dynamic_sidebar('sidebar-postnav'); ?>
        </div></div>
        <div class="bb-t16 bb-fc">
          <?php dynamic_sidebar('sidebar-links'); ?>
          <?php dynamic_sidebar('sidebar-postrelated'); ?>
        </div>
      </div>

      <div class="bb-tbase">
        <?php dynamic_sidebar('sidebar-bottom'); ?>
      </div>

    </div>
    </div>
  2. bb-t12 class sets the width of content-sub to 12 units (out of 30) which is 12/30 x 100 = 40%. bb-fc simply floats the column to the right. Inside content-sub is an additional <div> tag with a class bbin-a1 which sets the left padding (thus a) of the sidebar.
  3. However, the reason why currently there are three columns is this:
    <div class="bb-tbase">
      <div class="bb-t13 bb-fa"><div class="bbin-c1">
        <?php dynamic_sidebar('sidebar-postnav'); ?>
      </div></div>
      <div class="bb-t16 bb-fc">
        <?php dynamic_sidebar('sidebar-links'); ?>
        <?php dynamic_sidebar('sidebar-postrelated'); ?>
      </div>
    </div>
    where sidebar-postnav widget is placed inside a 13 unit wide column (bb-t12) which is aligned left (bb-fa), while sidebar-links and sidebar-postrelated are in a second column which is 16 units wide (bb-t16) and floated to the right (bb-fc). Class bb-tbase is simply a column base (float:left; width:100%; clear:both;) in which you place the columns.
  4. Notice that 13 + 16 = 29 units which leaves 1 unit spacing between these columns. Also the 13 unit column has an inner <div> which sets the right side padding (bbin-c1, thus c).
  5. To remove the two additional columns inside the sidebar, simply put the widget "boxes" one after another:
    <div class="bb-tbase">
      <?php dynamic_sidebar('sidebar-postnav'); ?>
      <?php dynamic_sidebar('sidebar-links'); ?>
      <?php dynamic_sidebar('sidebar-postrelated'); ?>
    </div>
  6. If you want to make the whole sidebar more narrow, change the sidebar wrapper from
    <div id="content-sub" class="bb-t12 bb-fc">...</div>
    to
    <div id="content-sub" class="bb-t8 bb-fc">...</div>
  7. Don't forget the adjust the width of the main content accordingly, from
    <div id="content-main" class="bb-t18 bb-fa">...</div>
    to
    <div id="content-main" class="bb-t22 bb-fa">...</div>
  8. Remember that the sum of column width inside one base should not exceed 30 units. You can always view the CSS Snippets as a reference.

Basic HTML structure of this theme

<div id="soul">
<div id="soul-content" class="bb-tbase">

  <div id="header">
    <div class="bb-t18 bb-fa">
      Logo
    </div>
    <div id="nav-main" class="nav-h bb-t12 bb-fc">
      Main Navigation
    </div>
  </div>

 <div class="bb-tbase">

  <div id="content-main" class="bb-t18 bb-fa">
    <div class="bbin-c3">
      Main Content
    </div>
  </div>

  <div id="content-sub" class="bb-t12 bb-fc">
    <div class="bbin-a1">
      Sidebar Content
    </div>
  </div>

 </div><!--content-->

  <div id="footer" class="bb-tbase">
    Footer Content
  </div>

</div>
</div>