The Death of the Boring Blog Post – Easily Add Columns to Any WordPress Post

The Death of the Boring Blog Post – Easily Add Columns to Any WordPress Post

Posted on 26. Nov, 2009 by Alex Denning in Art Direction

Smashing Magazine recently published a wonderful post “The Death of the Boring Blog Post” which touches more or less on what I shared the other day – multiple post templates. Today we’re going to expand on that tutorial (except this is the really easy way).
It was watching a screencast on Nettuts the other day that inspired this post. Jeffrey Way was showing how to change the background of a post with custom fields (which is yet another example of the brilliance of the things!) when he shows a demo on his personal test area. The test area is a framework called “Flexible-WP”. I have no idea what it’s designed to do, but looking at a post, this is a pretty neat idea. Set some styling and use divs within posts to put posts into columns.
Here’s an example. Jeffrey has a grid. This grid can then be applied within posts just by going into the HTML editor in WordPress and adding a div around some text:-


A paragraph of interesting text.
A paragraph of more interesting text.

And then you’d have two bits of text which would be in columns next to each other. Clever, no?

Implementation

Implementation of this is actually quite simple. You’ll need a grid. If you’re using a theme based on a framework, it’s quite probably got the 960 grid system built in, in which case you can use that. If not, open up your style.css file and either create your own or use something similar to the below which Jeffrey uses on his site:

.g1 { width: 60px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g2 { width: 140px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g3 { width: 220px; margin-left: 10px; margin-right: 10px; float: left; display: inline;}
.g4 { width: 300px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g5 { width: 380px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g6 { width: 460px; margin-left: 10px; margin-right: 10px; margin-bottom: 20px; float: left; display: inline; }
.g7 { width: 540px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g8 { width: 620px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g9 { width: 700px; margin-left: 10px; margin-right: 10px; margin-bottom: 20px; float: left; display: inline; }
.g10 { width: 780px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g11 { width: 860px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }
.g12 { width: 940px; margin-left: 10px; margin-right: 10px; float: left; display: inline; }

And then when writing, you can utilise your grid by wrapping text as I show above. A really easy (and effective) to make your blog post that bit more unique and exciting.

Related posts:

  1. Drop Caps For WordPress

Follow on Twitter! Subscribe!
Alex's Gravatar

Alex Denning is the founder of WPShout. A WordPress developer from London, Alex co-founded WPShift at the start of 2010 where he sells awesome WordPress themes.

You can find Alex on Twitter and at AlexDenning.com.

5 Responses to “The Death of the Boring Blog Post – Easily Add Columns to Any WordPress Post”

  1. Epic Alex

    27. Nov, 2009

    This was something I was looking at a while ago, and actually wrote a pretty basic plugin, but never really took the development very far. I thought it was an interesting concept because of all the newspaper style themes being released at the time. You can check it out here: http://epicalex.com/newspaper-style-posts

    I also came across another plugin the other day that did something similar and had a load of configurable options, and used WordPress’ built in page break function.
    http://www.code-styling.de/english/development/wordpress-plugin-page-columnist-en
    .-= Epic Alex´s last blog ..10 Google Wave Invites Up For Grabs! =-.

    Reply to this comment
  2. Jad Limcaco

    06. Dec, 2009

    Just tried doing this to my blog post and it works great. I created my own grid, but it’s the same concept. Thank you so much. I’ll probably use the technique on my next blog post.

    Reply to this comment
  3. Ant Gray

    06. Jun, 2010

    You may group common rules, like float and margin, so you have less code (easier to maintain).

    .g1, .g2, .g3, .g4, .g5, .g6, .g7, .g8, .g9, .g10, .g11, .g12{float:left;}

    That’s good practice.

    Reply to this comment

Trackbacks/Pingbacks

  1. [...] favourite. Using a simple grid system, it’s possible to put your content into many columns. This post explains all. You may ask why you don’t just use a <p class=”grid1″>-like [...]

  2. [...] layout in the style.css, but things like comment styling, post styles (perhaps you’ve got a custom post layout grid), list styling, blockquotes and the like can go into a new [...]

Leave a Reply

Please use your real name when commenting. Wrap code in <code> tags and make sure HTML is encoded. You can use regular HTML like <a href="... etc.

Get yours questions answered quicker

If you're using this post for paid work and have a question of any complexity then please ask at WPQuestions where you'll get a prompt response.