WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] remove post count (8 posts)

  1. J0rdan
    Member
    Posted 5 years ago #

    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

  2. J0rdan
    Member
    Posted 5 years ago #

    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

  3. MichaelH
    Member
    Posted 5 years ago #

    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.

  4. J0rdan
    Member
    Posted 5 years ago #

    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

  5. moshu
    Member
    Posted 5 years ago #

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

  6. J0rdan
    Member
    Posted 5 years ago #

    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

  7. moshu
    Member
    Posted 5 years ago #

    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.

  8. J0rdan
    Member
    Posted 5 years ago #

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

    Thanks
    Jordan

Topic Closed

This topic has been closed to new replies.

About this Topic