Return to Snippet

Revision: 51955
at October 8, 2011 06:57 by webtechdev


Initial Code
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;

Initial URL


Initial Description
Show wp categories in drop down list like ...

Initial Title
wp list categories with total number of posts in parenthises ( )  some usefull examples

Initial Tags
wordpress, category

Initial Language
PHP