Site icon Osclass Documentation & Knowledge Base

Remove category counts when it shows zero

This is a simple customization that will remove ad counts next to categories and subcategories when they do not contain any ads and shows (0). This works with most themes (BCute theme is used here).

Here is an example showing the default way category ad counts are displayed:

To change this, edit the file main.php within your theme directory. Then, locate this code (note: this code appears twice in the file, so find both instances):

<span>(<?php echo osc_category_total_items() ; ?>)</span>


Replace it with this code:

<span><?php if(osc_category_total_items()>0){ echo '('.osc_category_total_items().')';} ?></span>

Now, it should look something like this:

If you want to completely remove ALL category ad counts permanently, remove both instances of this code:

<span>(<?php echo osc_category_total_items() ; ?>)</span>