Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Page & Category Menu Bars »

How can I have my category widget display in two equal columns?


  #1  
Old Nov 10, 2009, 07:16 PM
barros1389's Avatar
barros1389
 
6 posts · Oct 2009
Boston
Send a message via AIM to barros1389
How can I have my category widget display it's categories in multiple columns?

It appears others have done something like the below code. However, I'm not sure where this would go?

Thanks in advance!



<?php
$get_cats = wp_list_categories( 'echo=0&title_li=&depth=1&hide_empty=0' );
// Get cats

$cat_array = explode('</li>',$get_cats);
// Split into array items

$columns = 4;
// How many columns (virtual)

$cats_shown = 0;
// Don't touch this, this is just a counter (used below)

echo '<ul style="display:inline;">';

foreach($cat_array as $category) {
$cats_shown++;

// The 2 lines below can be removed if you apply the style definitions to the classes (ie. cat-item, cat-item a etc..)
// This was just quicker and easier for me to use whilst testing the code.
$category = str_replace('<li','<li style="display:inline"',$category);
$category = str_replace('<a href','<a style="width:160px;display:block;float:left" href',$category);

if($cats_shown % $columns == 0) {
// If the counter is a multiple of the columns to show
print $category.'</li></ul><br /><ul style="display:inline;">';
}
else {
// Else just a regular item
print $category.'</li>';
}
}
echo '</ul>';
?>
  #2  
Old Nov 11, 2009, 06:14 AM
juggledad's Avatar
juggledad
 
23,632 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
off the top, I'd guess they put it in the widget.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Nov 11, 2009, 06:31 PM
barros1389's Avatar
barros1389
 
6 posts · Oct 2009
Boston
Send a message via AIM to barros1389
Well... I haven't installed any third party category plugin or widget. The category widget is the default installed when you install wordpress, and I'm using the Atahualpa theme, by the way and I love it. I just don't know where to add the above code to have multiple columns for the category widget.
  #4  
Old Nov 11, 2009, 06:45 PM
juggledad's Avatar
juggledad
 
23,632 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
well it would have to go into the plugin's code, of course you better have a wide sidebar or there's not going to be much space for the comments...
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to horizontally display the Category Posts Widget ? bryan85 Plugins & Atahualpa 0 Sep 6, 2009 06:28 PM
[SOLVED] category widget can not display inline in v3.4 duping812 New Versions, & Updating 5 Jul 11, 2009 11:10 AM
[SOLVED] Page Menu Sub Menus of Equal Width Craig Mattice Page & Category Menu Bars 4 Jun 17, 2009 03:46 AM
Disply posts in all three columns-- plus, ideally, a widget or two, too? petevannuys Sidebars & Widgets 2 Jun 11, 2009 06:51 PM
Changing a widget display from block to inline (Twitter Text Widget) Flur Sidebars & Widgets 2 May 7, 2009 11:45 AM


All times are GMT -6. The time now is 10:51 AM.


Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.