Skip to content

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

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.

Yay! 🎉 You made it to the end of the article!
Alex Denning
Share:

4 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Ant Gray
June 6, 2010 9:56 pm

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.

Speeding Up WordPress With If Statements | WPShout.com
February 15, 2010 6:17 pm

[…] 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 […]

Best Practices for Creating Unique Blog Posts | WPShout.com
January 27, 2010 5:36 pm

[…] 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 […]

Jad Limcaco
December 6, 2009 8:50 am

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.

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!