Three column posts in Wordpress

Jun29th
2009
••

Three column magazine style posts in Wordpress

Here is a working example of this.

Following up on my two column post hack for Wordpress, here is a method to doing it for three columns. There isn’t really too much different except a few small shanges in the CSS and PHP. Biggest change is using PHPs ceil() instead of round().

Take a look at the whole code first:


<?php
$content = apply_filters('the_content', $post->post_content);
$beth = explode('<p>', $content);
$i = 0;
foreach ($beth as $erica){
$i++;
$q = $i - 1;
if ($i == 0) {
echo $q.$erica;
}
}
$z = $q/3;
$i = 0;
echo "<div class='left l1'>\n";
foreach ($beth as $erica){
$i++;
$q = $i - 1;
if ($i != 1) {
// un-comment the next line
//echo "<p>".$erica;
//erase or comment out the next line
echo "<p>".$q.") ".$erica;
}
if ($i == ceil($z+1)){
echo "</div>\n\n<div class='left l2'>\n";
}
if ($i == ceil($z+$z+1) ){
echo "</div>\n\n<div class='left l3'>\n";
}
}
echo "</div>\n\n"
?>

Read the rest of this entry »

Tags:
Posted in Wordpress


More Recent Posts

jQuery graphical header image replacement

Jun1st
2009
••
Several months ago I had a project that included feeding ad images into the sidebar of a page. Not a big deal but, there was an issue. These images were all coming from a third party. There was a small chance that these images would not be uploaded correctly and …
Read the rest of this entry »

Tags: ,
Posted in jQuery

Photoshop patchwork text effect

Feb13th
2009
••
I played with a few settings and came up with a fun technique for making patchwork styled text. It’s a simple text effect and only takes a few steps to achieve. With more time involved, like anything, greater results. This is not very Web 2.0 but it has it’s place. …
Read the rest of this entry »

Tags:
Posted in Photoshop

Fun with Wordpress categories

Jan19th
2009
••
The truth is, playing with what you can do with categories in Wordpress is fun. Being one that doesn’t like to use plugins for most functions, I enjoy tooling around in the code and trying to make the code do it for me. So the question arose over on the Wordpress …
Read the rest of this entry »

Tags:
Posted in Wordpress