• INCEPTION THEME

    Clean, contrasting WordPress theme built on the foundation of Whiskey Air.
  • WHISKEY AIR THEME

    Clean developer theme, suited for heavy modifications.
  • X5 TURBO THEME

    3 columns Turbo theme, now reloaded!
  • CLEAR APPLE THEME

    Almost magazine theme, without the hassle of administration.

categories

I was doing some research the other day to minimize the space occupied by my single-worded categories, and I found a nice way to do it.

Add the following to your CSS stylesheet:

.right {float:left; width:160px;}
.left {float:left; width:160px;}

Add the following to your sidebar, making sure you respect the widget styles:

<div class="widget_box">
<h3>Categories</h3>
<?php
$cats = explode('<br />', wp_list_categories('title_li=&echo=0&show_count=1&depth=1&style=none'));
$cat_n = count($cats) - 1;

for($i=0;$i<$cat_n;$i++):
	if($i<$cat_n/2):
		$cat_left = $cat_left.'<li>'.$cats[$i].'</li>';
	elseif($i>=$cat_n/2):
		$cat_right = $cat_right.'<li>'.$cats[$i].'</li>';
	endif;
endfor;
?>

<ul class="left">
	<?php echo $cat_left;?>
</ul>
<ul class="right">
	<?php echo $cat_right;?>
</ul>
</div>

That’s it! Test it and tell me how it works.

One Response to How To Style WordPress Categories Into 2 Columns

  • Hi, thanks for sharing, I will try it.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>