WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] remove post count

[Resolved] remove post count

  • Can someone tell me how to remove the “Post Count” from a list of categories or simply point me in the right direction. It uses list_cats and from what I read, I’d need to edit it in the core file. –nerve racking–

    N e who…I want it to keep track of the posts under their categories, I just don’t like post count next to the category on the page.

    Thank You,
    Jordan

Viewing 7 replies - 1 through 7 (of 7 total)
  • Yes I’m new. I’m sure someone, somewhere has heart that is aching to help me! =) Fast learner. I’ve located the core file where the list-cats function is. Do I simply remove the

    ‘$optioncount = 0,’

    or is it more in depth.

    Jordan

    Might want to consider using the template tag, wp_list_categories(), instead of list_cats.

    But the show_count=0 parameter might work for you.

    Thanks for the quick response. I read your links, and was wondering if you could tell me what to alter with this code right here.

    function wp_list_cats($args = '') {
    	_deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()');
    
    	$r = wp_parse_args( $args );
    
    	// Map to new names.
    	if ( isset($r['optionall']) && isset($r['all']))
    		$r['show_option_all'] = $r['all'];
    	if ( isset($r['sort_column']) )
    		$r['orderby'] = $r['sort_column'];
    	if ( isset($r['sort_order']) )
    		$r['order'] = $r['sort_order'];
    	if ( isset($r['optiondates']) )
    		$r['show_last_update'] = $r['optiondates'];
    	if ( isset($r['optioncount']) )
    		$r['show_count'] = $r['optioncount'];
    	if ( isset($r['list']) )
    		$r['style'] = $r['list'] ? 'list' : 'break';
    	$r['title_li'] = '';
    
    	return wp_list_categories($r);
    }

    should I just detete the

    $r[‘show_count’] = $r[‘optioncount’]; ????

    Thanks

    No, never mess with core WP files. The only files you edit – your theme. Nothing else.

    I was searching through other forms, and they said to edit the function. If that is not how you remove the post count after categories, can you tell me how?

    Thanks
    Jordan

    You don’t touch core files. Period. You take your theme’s sidebar.php file and find the template tag that displays the categories list. See Michael’s post above.

    Your read the Documentation he linked to. You edit your sidebar.php code, by using the proper parameter (he also gave it to you, just READ!) in the termplate tag.

    Ok. Got it! Thank you for the help. I swear I read a thread who was instructing to change the core file.

    Thanks
    Jordan

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] remove post count’ is closed to new replies.