Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can this be achived?

Replace the post count on wp_list_categories with "Has Posts" instead of number and "No Posts" if none.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Add the below in your theme's functions.php. It should work the way you want

function my_list_categories( $output, $args ) {
    $output = str_replace( '(0)', '(No Posts)', $output );
    $output = preg_replace( '/\((\d+)\)/', '(Has Posts)', $output );
    return $output;
}
add_filter( 'wp_list_categories', 'my_list_categories', 10, 2 );
share|improve this answer
    
This replaced the post number, but it also changed the post category name. I need it to only replace the "(12)" for example –  Shae Oct 1 '13 at 15:34
    
I have improved the answer, please check. Now it should be fine –  Maruti Mohanty Oct 1 '13 at 16:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.