/ Published in: PHP

Show wp categories in drop down list like ...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
join all categoeis and show total post in category ================================================== <?php $categories = get_categories(); foreach ($categories as $cat) { if ($cat->category_parent != 0) { echo '<span style="padding-left:10px;">'; } echo 'category_nicename.'/">'.$cat->cat_name.' ('.$cat->category_count.')'; if ($cat->category_description != '') { echo ' - '.$cat->category_description; } if ($cat->category_parent != 0) { echo '</span>'; } echo ' '; } ?> remove parenthises from wp_list_categories() ============================================== $variable = wp_list_categories('echo=0&show_count=1&child_of=&title_li='); $variable = str_replace(array('(',')'), '', $variable); $variable = str_replace("<ul>" , '' , $variable ); echo $variable;
Comments
