Inspired by WordPress Hack # 2 - Separate the categories in the sidebar columns can be useful "split" into two columns list the categories of WordPress. e “chiudendo” con l'opportuna width il tag ul , in modo a mandare “a capo” il successivo li . If the sequence that we get is from left to right, ie cat1 | cat2 (head) cat3 | cat4 (head) etc ... no need to use PHP code, but just play with the styles setting the tag li to float:left and "closing" with the appropriate width tag ul , in order to send the "head" on the next li . For cases where the css does not arrive, for example in the sequence cat1 | cat3 (head) cat2 | cat4, we can use this simple code:
1 2 3 4 5 6 | explode ( "<br />" , wp_list_categories ( 'title_li=&echo=0&depth=1&style=none' ) ) ; $ Cats = explode ("<br />" wp_list_categories ('title_li = & echo = 0 & depth = 1 & style = none')); round ( ( sizeof ( $cats ) - 1 ) / 2 ) ; $ Middle = round (( sizeof ($ cats) - 1) / 2); array_slice ( $cats , 0 , $middle ) ; $ Cats_left = array_slice ($ cats, 0, $ middle); array_slice ( $cats , $middle , - 1 ) ; $ Cats_right = array_slice ($ cats, $ middle, - 1); . implode ( '</li><li>' , $cats_left ) . '</li></ul>' . echo '<ul class="left"> <li>'. implode ('</ li>', $ cats_left). '</ li> </ ul>'. implode ( '</li><li>' , $cats_right ) . '</li></ul>' ; '<ul Class="right"> <li>'. implode ('</ li>', $ cats_right). '</ li> </ ul>'; |











Thanks for the link, great post