A Blog about Linux, Open Source and Code! 
Symsys Inform Blog Home

Symsys Ltd Text logo in the banner area

Author:  Symsys
October 18, 2008



Ever since the recent update of WordPress to the new WordPress 2.6.2 all the How To’s out there on the web are getting slightly out of date due to things not being the same in the code of the updated WordPress. This naturally causes some confusion with those out there that are not used to editing PHP and are cautious about editing source code.

This is to correct the layout glitch of the what should be a simple function of adding post counts next to category items.

The easy part – adding the function in the WordPress Site Admin.

Go to Design >> Widgets >> Edit the ‘Categories’ widget (of course make sure it is added as a current widget)
Tick the box that says ‘Show Post Counts’ – hit ‘Change’, then ‘Save Changes’ at the bottom.

Problem occurs that the post count is displayed as a link UNDER the category text making the list very messy and very long. The purpose of this post is to simply give the correct line numbers and exact code that exists in wordpress 2.6.2 which is different from older versions and make it easier for people.


Download ‘ classes.php’ from the ‘wp-includes’ directory and edit is as follows.

lines 674 & 645 says

	if ( isset($show_count) && $show_count )
			$link .= ' (' . intval($category->count) . ')';

Comment this out by putting in two forward slashes // or simply delete it.

On line 644

$link .= $cat_name . '';


$link .= $cat_name;
if ( isset($show_count) && $show_count ) {
$link .= ' (' . intval($category->count) . ')'. '';

Save and upload it again to overwrite the original classes.php in the wp-includes directory and thats it – Done.

Filed under: Code,Wordpress ... Comments (3)

Tags: , , , , ,


3 Responses for "WordPress 2.6.2 Put post count NEXT TO category"»

  1. Gremlette


    I saw a referral link come in from the wordpress forums and it appears that some had difficulty with just commenting out the lines 674 and 675. On that particular instance it seems that the best method was to delete the lines instead of just commenting them out.

    When I first set up this blog not very long ago, things were working great, then literally 3 days after I got everything underway, WordPress 2.6.2 was available to upgrade – so I did. Of course, a few widgets broke. A month or so later, the upgraded widgets come along and didn’t work, so I was thankful that the older versions that do work were still on my hard drive to re-upload. The price for not being satisfied with standard eh?! :)

    For the most part, we are just really enjoying making the blog posts here at Symsys. When I get around to the ‘fiddling’ again I will be discussing WordPress a bit more and doing more of that on the WordPress forums, not just here.

  2. harbans-lal-gera

    Harbans Lal Gera – I know this is off topic but need help with Vista

    Harbans Lal Gera

Leave a Reply


Enter your email address:

Delivered by FeedBurner