WordPress: Multiple Content Columns

I’ve been working on a WordPress site for a client with one of our developers Tom Hartnell. The design of this particular site was that some pages would need content displayed over multiple columns. This content had to be updatable by the client, as such it could not be hard coded into the template files.

We had a look around and we found a potential solution on this blog post.

We played around with this for a while but found that, whilst it was a good solution, it wasn’t quite suitable for our needs. What we needed was a solution which allowed us to have any number of columns and for each column to contain completely different content. The solution in the post demanded that each column start with the same HTML tag (H2 in the example). We decided to rewrite the function described above, based on the same principals, but updated and improved so it would fit our needs.

To see what the end result is, you can see a demo page.

The first thing the new function had to do was to split the content into the different columns using the more tag. In our tests, we found that WordPress replaced the more tag with a span, but only in the first instance, all the rest were kept as a comment tag. The regular expression we used had to take this into account.

// the first "more" is converted to a span with ID
$columns = preg_split('/(<span id="more-d+"></span>)|(<!--more-->)</p>/', $content);

This regular expression is not bullet proof, but it does the job for us. Specifically, if you are using a plugin like “Sociable” or something that appends stuff to the end of the content then this stuff will end up in the third column and not nicely across the bottom of the page. Also, it hasn’t been tested when adding images. These two issues weren’t going to be a problem for us, so the regular expression above is perfectly adequate for our needs.

Next we need to loop through each column, removing any stray <p> tags that may have been orphaned by the regular expression and putting the content into separate divs.

$col_count = count($columns);
for($i=0; $i<$col_count; $i++) {
 
	// check to see if there is a final, if not add it
	if(!preg_match('/</p>s?$/', $columns[$i]) )  {
		$columns[$i] .= '</p>';
	}
	// check to see if there is an appending, if there is, remove
	$columns[$i] = preg_replace('/^s?</p>/', '', $columns[$i]);
	// now add the div wrapper
	$columns[$i] = '<div class="dynamic-col-'.($i+1).'">'.$columns[$i].'</div>';
}

Finally we can join the columns back together to produce the final content.

$content = join($columns, "n").'<div class="clear"></div>';

Notice that we have added a clearing div here. This is basically so you can clear the floats with CSS so any content displayed below the page content will be correctly positioned.

What if there isn’t a more tag? We will only have one column. As such there is no need to modify the content, so the code above should go into an if statement

if($col_count > 1) {
	...
}

The last job to do in this function is to clear out any blank <p> tags caused by the regular expression and return the content

// remove any left over empty tags
$content = str_replace('<p></p>', '', $content);
return $content;

This would normally all be contained in a function (we called my_multi_col_v2) that would be called as a filter function, however, we found that this was causing problems with the WordPress excerpts, so instead we are overriding the default content display function in the page.php file.
In your page.php file, replace the line that calls the the_content() function

//the_content('Read the rest of this entry &raquo;');

Now we collect the content into a variable, then pass this variable to the new function, outputting the result. The function that gets the content instead of directly outputting it is get_the_content():

$content = get_the_content('',FALSE,''); //arguments remove 'more' text
echo my_multi_col_v2($content);

As we are using get_the_content() the default filtering that is normally done on the content is not being run. So at the top of our new function, we must manually run these

// run through a couple of essential tasks to prepare the content
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);

This also caused a problem with line breaks when only displaying one column, so we needed to include an else statement that ran wpautop()

else {
	// this page does not have dynamic columns
	$content = wpautop($content);
}

So the final function looks like this:

function my_multi_col_v2($content){
	// run through a couple of essential tasks to prepare the content
	$content = apply_filters('the_content', $content);
	$content = str_replace(']]>', ']]&gt;', $content);
 
	// the first "more" is converted to a span with ID
	$columns = preg_split('/(<span id="more-d+"></span>)|(<!--more-->)</p>/', $content);
	$col_count = count($columns);
 
	if($col_count > 1) {
		for($i=0; $i<$col_count; $i++) {
			// check to see if there is a final </p>, if not add it
			if(!preg_match('/</p>s?$/', $columns[$i]) )  {
				$columns[$i] .= '</p>';
			}
			// check to see if there is an appending </p>, if there is, remove
			$columns[$i] = preg_replace('/^s?</p>/', '', $columns[$i]);
			// now add the div wrapper
			$columns[$i] = '<div class="dynamic-col-'.($i+1).'">'.$columns[$i].'</div>';
		}
		$content = join($columns, "n").'<div class="clear"></div>';
	}
	else {
		// this page does not have dynamic columns
		$content = wpautop($content);
	}
	// remove any left over empty <p> tags
	$content = str_replace('<p></p>', '', $content);
	return $content;
}

The next thing to do is to update your CSS so it lays out the columns correctly. In the demo I have used three columns, and the CSS for it looks like this:

/* dynamic columns */
div.dynamic-col-1 { float: left; width: 38%; padding-right: 2%;}
div.dynamic-col-2 { float: left; width: 38%;padding-right: 2%;}
div.dynamic-col-3 { float: left; width: 20%;}
div.clear { clear: both; }

And that’s pretty much it. Have a look at the demo, below is a screenshot of the WordPress editor screen so you can see that it really is controlled by the user, you should see the two more tags that are used to split the content into the three columns.

Wordpress multiple content columns, editor input

Wordpress multiple content columns, editor input

Please feel free to take this, improve it, update it, completely rewrite it. If you do please can you drop me a comment and let me know. And a big thanks to Kriesi for his initial work and for providing inspiration for this blog post.

  • http://www.cybershack.qc.ca patrickmatte

    Very useful. I’m going to give it a try.

  • Pingback: Rob Searles » Wordpress: Multiple Content Columns

  • Pingback: Rob Searles » Wordpress: Multiple Content Columns

  • patrickmatte

    Very useful. I'm going to give it a try.

  • fruddle

    Hello Rob,

    I was looking for something to”column”my output in wordpress. This is the thing for me. Thanks a lot!

    Barry

  • fruddle

    Hello Rob,

    I was looking for something to”column”my output in wordpress. This is the thing for me. Thanks a lot!

    Barry

  • http://www.robsearles.com Rob Searles

    Cheers guys, glad you found it useful

  • http://www.robsearles.com Rob Searles

    Cheers guys, glad you found it useful

  • Jess

    Thanks Rob! The way you did that makes total sense, and it looks like it should work. However I must be doing something wrong because it has no effect on my pages/posts at all. I’m really bummed because it’s such a great solution for those who have little coding knowledge.

    • http://www.robsearles.com Rob Searles

      Hi Jess,

      I noticed a problem with this solution is that you need to make sure the “more” tag is on it’s own completely separate line. If it shares a line with a “br” or other “p” tags it doesn’t seem to work.

      Hopefully this is the same problem you’re having? If not, do you want to post a snippet of your code up here and hopefully that will provide some more clues.
      Cheers
      Rob

  • Jess

    Thanks Rob! The way you did that makes total sense, and it looks like it should work. However I must be doing something wrong because it has no effect on my pages/posts at all. I'm really bummed because it's such a great solution for those who have little coding knowledge.

  • http://www.robsearles.com Rob Searles

    Hi Jess,

    I noticed a problem with this solution is that you need to make sure the “more” tag is on it's own completely separate line. If it shares a line with a “br” or other “p” tags it doesn't seem to work.

    Hopefully this is the same problem you're having? If not, do you want to post a snippet of your code up here and hopefully that will provide some more clues.
    Cheers
    Rob

  • mumford

    Hi

    This is exactly what I am after, but can you tell me what code i put into page.php and what code i put into functions.php

    Also when I edit a page in wordpress do I actually put he code in eg

    Column One
    This is a demonstration page for my WordPress hack for dividing the content into multiple columns. For more information please visit my multiple content columns blog post.
    Donec rhoncus urna a odio dapibus suscipit. Nullam consectetur est ac elit consequat quis tristique velit dictum. Donec nisi felis, placerat quis sagittis in, vestibulum id tellus. Etiam vitae elit in tellus bibendum tristique. Vivamus semper tortor vitae augue adipiscing faucibus.

    Column Two
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam tempor sagittis blandit. Nulla facilisi. Nulla consectetur, mauris quis mollis consequat, purus nibh pharetra velit, a facilisis libero tortor quis massa. Nunc fringilla ultrices convallis.
    In varius risus eu nisi dictum vitae lobortis erat vulputate. Proin laoreet diam ac turpis placerat luctus. In commodo turpis vel orci volutpat sed vehicula quam consectetur. Sed a turpis vel metus aliquam venenatis ac sit amet tortor. Vivamus facilisis ornare volutpat. Maecenas tincidunt mollis ligula, volutpat ultricies ipsum commodo vel.

    Column Three
    Nam non nisl eget erat pretium accumsan. Ut interdum, erat a molestie eleifend, purus odio consectetur nibh, id condimentum odio nulla sed magna.
    Fusce quam nisl, egestas sit amet vestibulum posuere, egestas sed ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    Hope you can help!

    Thanks

    • http://www.robsearles.com Rob Searles

      Hi Mumford,

      In your page.php template you need to find the block that says something like:
      if (is_page()) {
      the_content(‘Read the rest of this entry »’);
      }
      and replace it with
      if (is_page()) {
      $content = get_the_content(”,FALSE,”); //arguments remove ‘more’ text
      echo my_multi_col_v2($content);
      }

      Then in functions.php, probably at the bottom you need to copy and paste the whole my_multi_col_v2($content) function as above, e.g:

      function my_multi_col_v2($content){
      … blah blah blah …
      }

      You do not need to explicitly add the in manually, you just need to make sure you add the more tag using the WYSIWYG editor.

      Hope this helps. Have fun
      Rob

  • mumford

    Hi

    This is exactly what I am after, but can you tell me what code i put into page.php and what code i put into functions.php

    Also when I edit a page in wordpress do I actually put he code in eg

    <div class=”dynamic-col-1″>

    Column One

    This is a demonstration page for my WordPress hack for dividing the content into multiple columns. For more information please visit my multiple content columns blog post.

    Donec rhoncus urna a odio dapibus suscipit. Nullam consectetur est ac elit consequat quis tristique velit dictum. Donec nisi felis, placerat quis sagittis in, vestibulum id tellus. Etiam vitae elit in tellus bibendum tristique. Vivamus semper tortor vitae augue adipiscing faucibus.

    </div>
    <div class=”dynamic-col-2″>

    Column Two

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam tempor sagittis blandit. Nulla facilisi. Nulla consectetur, mauris quis mollis consequat, purus nibh pharetra velit, a facilisis libero tortor quis massa. Nunc fringilla ultrices convallis.

    In varius risus eu nisi dictum vitae lobortis erat vulputate. Proin laoreet diam ac turpis placerat luctus. In commodo turpis vel orci volutpat sed vehicula quam consectetur. Sed a turpis vel metus aliquam venenatis ac sit amet tortor. Vivamus facilisis ornare volutpat. Maecenas tincidunt mollis ligula, volutpat ultricies ipsum commodo vel.

    </div>

    <div class=”dynamic-col-3″>

    Column Three

    Nam non nisl eget erat pretium accumsan. Ut interdum, erat a molestie eleifend, purus odio consectetur nibh, id condimentum odio nulla sed magna.

    Fusce quam nisl, egestas sit amet vestibulum posuere, egestas sed ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    </div>

    Hope you can help!

    Thanks

  • http://www.robsearles.com Rob Searles

    Hi Mumford,

    In your page.php template you need to find the block that says something like:
    if (is_page()) {
    the_content('Read the rest of this entry »');
    }
    and replace it with
    if (is_page()) {
    $content = get_the_content('',FALSE,''); //arguments remove 'more' text
    echo my_multi_col_v2($content);
    }

    Then in functions.php, probably at the bottom you need to copy and paste the whole my_multi_col_v2($content) function as above, e.g:

    function my_multi_col_v2($content){
    … blah blah blah …
    }

    You do not need to explicitly add the <div class=”dynamic-col-x”></div> in manually, you just need to make sure you add the more tag using the WYSIWYG editor.

    Hope this helps. Have fun
    Rob

  • tdude

    Hi Rob!
    It’s guys like you (and Google) who make creating websites fun! Whenever there´s a problem there seems to be a clever solution somewhere.
    Many thanx!

    • http://www.robsearles.com Rob Searles

      Glad you found it useful!

  • tdude

    Hi Rob!
    It's guys like you (and Google) who make creating websites fun! Whenever there´s a problem there seems to be a clever solution somewhere.
    Many thanx!

  • http://www.robsearles.com Rob Searles

    Glad you found it useful!

  • M

    Thanks, you are awesome wordpress ninja, man!

    I hope that some theme authors will spot this, because I can see lot of uses ^^

    • M

      Hi, I have used your function at my site, check it out here: http://www.hwsupport.cz/sluzby/kurzy-a-skoleni (Woo Vibrant CMS theme + custom mods + your AWESOME function)…
      thanks (͡๏̯͡๏)

      • http://www.robsearles.com Rob Searles

        No problem! It’s great that people are using it on their sites!

  • tdude

    Hi again! Yes. Very useful.
    Just had a little tinker with your code to get it accept 2 & 3 column layouts that span the whole containing div with their respective widths. Something like when you have a 2 col layout with 2 “more” tags, they span 100% and the same for a 3 col layout. If someone with a decent knowledge of php took this apart it would probably be even more flexible with less code, but the code below works fine for my purposes ;)

    Here goes for functions.php:

    function my_multi_col_v2($content){
    // run through a couple of essential tasks to prepare the content
    $content = apply_filters(‘the_content’, $content);
    $content = str_replace(‘]]>’, ‘]]>’, $content);

    // the first “more” is converted to a span with ID
    $columns = preg_split(‘/()|()/’, $content);
    $col_count = count($columns);

    if($col_count == 2) {
    for($i=0; $i<$col_count; $i++) {
    // check to see if there is a final , if not add it
    if(!preg_match(‘/s?$/’, $columns[$i]) ) {
    $columns[$i] .= ”;
    }
    // check to see if there is an appending , if there is, remove
    $columns[$i] = preg_replace(‘/^s?/’, ”, $columns[$i]);
    // now add the div wrapper
    $columns[$i] = ”.$columns[$i].”;
    }
    $content = join($columns, “n”).”;
    }

    if($col_count == 3) {
    for($i=0; $i<$col_count; $i++) {
    // check to see if there is a final , if not add it
    if(!preg_match(‘/s?$/’, $columns[$i]) ) {
    $columns[$i] .= ”;
    }
    // check to see if there is an appending , if there is, remove
    $columns[$i] = preg_replace(‘/^s?/’, ”, $columns[$i]);
    // now add the div wrapper
    $columns[$i] = ”.$columns[$i].”;
    }
    $content = join($columns, “n”).”;
    }

    else {
    // this page does not have dynamic columns
    $content = wpautop($content);
    }
    // remove any left over empty tags
    $content = str_replace(”, ”, $content);
    return $content;
    }

    And this for style.css:

    /* dynamic wordpress content columns for the “More tag” from http://www.robsearles.com/2009/07/05/wordpress-multiple-content-columns/ */
    div.dynamic-2col-1 { float: left; width: 47%; padding-right: 8%;}
    div.dynamic-2col-2 { float: left; width: 45%;padding-right: 0%;}

    div.dynamic-3col-1 { float: left; width: 30%; padding-right: 4%;}
    div.dynamic-3col-2 { float: left; width: 30%;padding-right: 4%;}
    div.dynamic-3col-3 { float: left; width: 30%;}

    • http://www.robsearles.com Rob Searles

      Nice! When I get a spare second or two I’ll test it out.
      Thanks

  • tdude

    Hi again! Yes. Very useful.
    Just had a little tinker with your code to get it accept 2 & 3 column layouts that span the whole containing div with their respective widths. Something like when you have a 2 col layout with 2 “more” tags, they span 100% and the same for a 3 col layout. If someone with a decent knowledge of php took this apart it would probably be even more flexible with less code, but the code below works fine for my purposes ;)

    Here goes for functions.php:

    function my_multi_col_v2($content){
    // run through a couple of essential tasks to prepare the content
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);

    // the first “more” is converted to a span with ID
    $columns = preg_split('/(<span id=”more-d+”></span>)|(<!–more–>)</p>/', $content);
    $col_count = count($columns);

    if($col_count == 2) {
    for($i=0; $i<$col_count; $i++) {
    // check to see if there is a final , if not add it
    if(!preg_match('/</p>s?$/', $columns[$i]) ) {
    $columns[$i] .= '';
    }
    // check to see if there is an appending , if there is, remove
    $columns[$i] = preg_replace('/^s?</p>/', '', $columns[$i]);
    // now add the div wrapper
    $columns[$i] = '<div class=”dynamic-2col-'.($i+1).'”>'.$columns[$i].'</div>';
    }
    $content = join($columns, “n”).'<div class=”clear”></div>';
    }

    if($col_count == 3) {
    for($i=0; $i<$col_count; $i++) {
    // check to see if there is a final , if not add it
    if(!preg_match('/</p>s?$/', $columns[$i]) ) {
    $columns[$i] .= '';
    }
    // check to see if there is an appending , if there is, remove
    $columns[$i] = preg_replace('/^s?</p>/', '', $columns[$i]);
    // now add the div wrapper
    $columns[$i] = '<div class=”dynamic-3col-'.($i+1).'”>'.$columns[$i].'</div>';
    }
    $content = join($columns, “n”).'<div class=”clear”></div>';
    }

    else {
    // this page does not have dynamic columns
    $content = wpautop($content);
    }
    // remove any left over empty

    tags
    $content = str_replace('

    ', '', $content);
    return $content;
    }

    And this for style.css:

    /* dynamic wordpress content columns for the “More tag” from http://www.robsearles.com/2009/07/05/wordpress-… */
    div.dynamic-2col-1 { float: left; width: 47%; padding-right: 8%;}
    div.dynamic-2col-2 { float: left; width: 45%;padding-right: 0%;}

    div.dynamic-3col-1 { float: left; width: 30%; padding-right: 4%;}
    div.dynamic-3col-2 { float: left; width: 30%;padding-right: 4%;}
    div.dynamic-3col-3 { float: left; width: 30%;}

  • http://www.robsearles.com Rob Searles

    Nice! When I get a spare second or two I'll test it out.
    Thanks

  • M

    Hi, I have used your function at my site, check it out here: http://www.hwsupport.cz/sluzby/kurzy-a-skoleni (Woo Vibrant CMS theme + custom mods + your AWESOME function)…
    thanks (͡๏̯͡๏)

  • http://www.robsearles.com Rob Searles

    No problem! It's great that people are using it on their sites!

  • http://technohippy.geek.nz/ Nate

    Much thanks :)

  • http://technohippy.geek.nz/ Nate

    Much thanks :)

  • Mojopowder

    I can’t find any of the code you’re talking about, i.e., if (is_page), etc. in wordpress 2.8.6. Has it changed and how to we add this coding to 2.8.6? Here is what I find in the default theme and my custom theme: <?php the_content('Read the rest of this page »’); ?>

    • http://www.robsearles.com Rob Searles

      Hi Mojopowder,

      You don’t necessarily need the is_page() statement. This is just a conditional to decide if what you’re displaying is a page or a post. If you know that you’ll be displaying a page (i.e. within the Page.php template) then you may not need this.

      You can just replace the the_content(blah) code with the following:
      $content = get_the_content(”,FALSE,”); //arguments remove ‘more’ text
      echo my_multi_col_v2($content);
      //the_content(‘Read the rest of this entry »’);

      However, for greater flexibility to you utilise the is_page() – and other conditional statements. For more info see here:
      http://codex.wordpress.org/Conditional_Tags
      and here:
      http://wordpress.org/tags/is_page

      Hope this helps?
      Thanks for you comment
      Rob

  • Mojopowder

    I can't find any of the code you're talking about, i.e., if (is_page), etc. in wordpress 2.8.6. Has it changed and how to we add this coding to 2.8.6? Here is what I find in the default theme and my custom theme: <?php the_content('

    Read the rest of this page »

    '); ?>

  • http://www.robsearles.com Rob Searles

    Hi Mojopowder,

    You don't necessarily need the is_page() statement. This is just a conditional to decide if what you're displaying is a page or a post. If you know that you'll be displaying a page (i.e. within the Page.php template) then you may not need this.

    You can just replace the the_content(blah) code with the following:
    $content = get_the_content('',FALSE,''); //arguments remove 'more' text
    echo my_multi_col_v2($content);
    //the_content('Read the rest of this entry »');

    However, for greater flexibility to you utilise the is_page() – and other conditional statements. For more info see here:
    http://codex.wordpress.org/Conditional_Tags
    and here:
    http://wordpress.org/tags/is_page

    Hope this helps?
    Thanks for you comment
    Rob

  • Pingback: Twitter Weekly Updates for 2009-12-20

  • http://pupungbp.erastica.com/ pupungbp

    Thanks for the solution :)

    Is it working on WP 2.9.1 ? have anyone tested it?

  • http://www.adriangould.com/ Adrian

    Lovely stuff! I wonder if anyone with the skills would be interested in taking the concept and applying it to GetSimple (http://www.get-simple.info/), which is a very nice little CMS that takes a lot of its cues from WP, but is a MUCH simpler system. It lacks a couple of functions/plugins that would make it infinitely more appealing – one being a multi-column option, another being an easily populated multi-level navigation menu.

    I think you have a great solution for that first one right here – anyone got the appetite for ‘porting’ it to GetSimple (my php skillz are not up to the task!)?

  • AdrianGould

    Lovely stuff! I wonder if anyone with the skills would be interested in taking the concept and applying it to GetSimple (http://www.get-simple.info/), which is a very nice little CMS that takes a lot of its cues from WP, but is a MUCH simpler system. It lacks a couple of functions/plugins that would make it infinitely more appealing – one being a multi-column option, another being an easily populated multi-level navigation menu.

    I think you have a great solution for that first one right here – anyone got the appetite for 'porting' it to GetSimple (my php skillz are not up to the task!)?

  • Pingback: Nga

  • Pingback: Derosa

  • Pingback: 6 Ways to Display WordPress Post Content in Multiple Columns | Digging into WordPress

  • Alejandro

    very usefull help. Can this be used if the content has pagination?

  • Alejandro

    very usefull help. Can this be used if the content has pagination?

  • http://twitter.com/johnsamwallace John Sam Wallace

    It works with Thematic!

  • http://twitter.com/johnsamwallace John Sam Wallace

    It works with Thematic!

  • justinrhee

    Even though I updated my theme’s function.php, my content doesn’t get split into dynamic columns (only tags) and shows only the first blurb of text before the first tag. The rest gets lost.

    Could it be because I’m using WP 2.9.2? If not, then any idea what it could be? I would much appreciate it.

  • justinrhee

    Even though I updated my theme's function.php, my content doesn't get split into dynamic columns (only

    tags) and shows only the first blurb of text before the first <!–more–> tag. The rest gets lost.

    Could it be because I'm using WP 2.9.2? If not, then any idea what it could be? I would much appreciate it.

  • Tjsulli2

    Hi – Can’t get this to work in Thematic. Where do I post everything specifically for Thematic? Thanks

  • Menesrk

    I added it to my site, but it doesn’t work with multiple posts apparently, .. I want the posts to show up in different columns..?? on the wordpress site where this was listed it said i needed “a couple” more tags (i’m thinking two more tags) but here you only have 1. does this work with different posts on the same page? http://konphlux.net / news

  • sWhitted

    has anyone experienced any issues with this not working in IE8?

  • http://barnabasnagy.com Barnabas Nagy

    I would need the same thing but done automatically without more tags.

  • http://furlongdesign.com/ Barnabas Nagy

    I would need the same thing but done automatically without more tags.

  • http://pulse.yahoo.com/_AGNOOKIOTB5K24DE4OB5BN6ZZ4 John Grahams
  • http://pulse.yahoo.com/_AGNOOKIOTB5K24DE4OB5BN6ZZ4 John Grahams
  • Thom Hubers

    Worked for me when I changed RegEx into: ’/(|)/’

    The | should not be between ) and (. And the part caused problems.

    Fine function though!

  • Thom Hubers

    Worked for me when I changed RegEx into: '/(</span>|)/'

    The | should not be between ) and (. And the

    part caused problems.

    Fine function though!

  • http://www.cafenaderi.ir/ Emad Naderi

    Please download a sample index.php Thanks

  • http://www.cafenaderi.ir/ Emad Naderi

    Please download a sample index.php Thanks

  • Nic Flook

    This is an interesting solution for introducing columns to the content. It seems to be working well when there are two or three columns. However, when there is just one column required it adds an empty second column. Has anyone else noticed this? If anyone has come across this and fixed it I’d like to know where I might be going wrong. So far I’m testing my site in Safari and Firefox on the Mac and using WP 3.4. 

    Thanks
    Nic

    • Nic Flook

       It’s cool. I just made a slight adjustment to the else statement and added a fall back column around the $content. So it defaults to a single column gracefully.

  • Nic Flook

    This is an interesting solution for introducing columns to the content. It seems to be working well when there are two or three columns. However, when there is just one column required it adds an empty second column. Has anyone else noticed this? If anyone has come across this and fixed it I'd like to know where I might be going wrong. So far I'm testing my site in Safari and Firefox on the Mac and using WP 3.4. 

    Thanks
    Nic

  • Nic Flook

     It's cool. I just made a slight adjustment to the else statement and added a fall back column around the $content. So it defaults to a single column gracefully.