Author Topic: Changing the color of the category count  (Read 2255 times)


  • Newbie
  • *
  • Posts: 14
Changing the color of the category count
« on: June 30, 2011, 06:35:43 pm »
I'm probably blind, but I can't seem to see where I can modify the color of the category count number via CSS. (see attached pic)

I did manage to change the color of the main item count for All Categories, but did that by hard-coding it into main.php and when I tried to do the same for the sub-category counts, it disappeared entirely.

Here is my temporary fix to at least try to figure it out (because I can't seem to find where it's controlled via CSS):

Code: [Select]
<?php while ( osc_has_categories() ) { ?>
                            <div class="category">
                                <h1><strong><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span> [color=red]<font color="#333333">[/color](<?php echo osc_category_total_items() ; ?>)</font></span></strong></h1>
                                <?php if ( osc_count_subcategories() > ) { ?>
                                        <?php while ( osc_has_subcategories() ) { ?>
                                            <li><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span> (<?php echo osc_category_total_items() ; ?>)</span></li>
                                        <?php ?>
                                <?php ?>
if (($col==&& $i==$col1_max_cat) || ($col==&& $i==$col2_max_cat) || ($col==&& $i==$col3_max_cat)) {
$i 1;
$x $total_categories) {
'<div class="col c'.$col.'">';
                                } else {
$i++ ;
$x++ ;

                        <?php ?>

Thanks in advance!


  • Administrator
  • Hero Member
  • *****
  • Posts: 974
Re: Changing the color of the category count
« Reply #1 on: June 30, 2011, 07:37:08 pm »
Hi a way to do this easy and clean, can try this solution:

This is actual code : (prints the number of items)
<span>(<?php echo osc_category_total_items() ; ?>)</span> (main.php l.55, l.59)

Adding a class to the span element, then can add some style:
<span class='parent_cat_total_items'>(<?php echo osc_category_total_items() ; ?>)</span>  // style for parent categories l.55
<span class='sub_cat_total_items'>(<?php echo osc_category_total_items() ; ?>)</span>      // style for sub categories l.59

Now is possible add some css style for this classes.

In the style.css located at oc-content/themes/modern/css/style.css ( if use modern theme ) we need to add this:

For parent categories (class parent_cat_total_items):
    .home #main .categories .category span.parent_cat_total_items { color:red;}

For sub categories (class sub_cat_total_items):
    .parent_cat_total_items { color:blue;}