Show your categories in two Columns!
I said about if and else with two or more single.php article. Also you can use this simple functions on your categories. You can show your categories in two columns. This a simple code and you can apply it only copy/paste :)
Here is the code;
We use wp_list_categories(); function when we calling our categories. But if we change this function we can change our category listing. Just copy and paste this function in your sidebar.php file and show your categories in two columns.
<?php
$cats = explode("<br />",wp_list_categories('title_li=&echo=0&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>
After that we have to change our style.css for left and right terms. her is the code;
.right {float:left; width:140px;}
.left {float:left; width:140px;}
That’s All. Have a nice day!
The Original Post: Blog-Oh-Blog
This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.
Post your comments
-
Categories
Colored Tags
RSS style.css plugin funcitons image theme single.php Wordpress category index.php content Widget categories if Functions time sidebar post title else css feed functions.php author code site header.php function javascript template Google robots article Yahoo posts comments hide spiders blog comment Facebook Loop no-index comments.php mysqlRecent Comments
Archives
Blogroll
Google Ads















Made by Symmetric Web
Distributed by Smashing Magazine
1 Response
[...] your sidebar.php file and show your categories in two columns. “,wHere is the original post:Show your categories in two Columns!Related Posts:Show your Mood to Readers.Code To Display Categories In Drop Down Format In WordPress [...]