Advertisement:

Author Topic: How to hide category and sub category when no classified is there  (Read 993 times)

bengalliboy

  • Full Member
  • ***
  • Posts: 204
I am using the bender theme where it is pooling the category on front page with this code:
 bender_add_body_class('home');
How and where do I change the code to hide the category and sub category where there is no item dynamically?
Here is my site:
http://bazaar.city/

Thank you so much

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: How to hide category and sub category when no classified is there
« Reply #1 on: January 31, 2015, 03:35:18 pm »
Any update yet?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to hide category and sub category when no classified is there
« Reply #2 on: January 31, 2015, 04:21:37 pm »
Hi,

I think this is what you are asking for: ???

Locate this block in bender/functions.php:

Code: [Select]
                    if ( osc_count_subcategories() > 0 ) { ?>
                    <span class="collapse resp-toogle"><i class="fa fa-caret-right fa-lg"></i></span>
                    <?php ?>
                    <?php if($_total_items 0) { ?>
                    <a class="category <?php echo $_slug?>" href="<?php echo $_url?>"><?php echo $_name ?></a> <span>(<?php echo $_total_items ?>)</span>
                    <?php } else { ?>
                    <a class="category <?php echo $_slug?>" href="#"><?php echo $_name ?></a> <span>(<?php echo $_total_items ?>)</span>
                    <?php ?>
                 </h1>
                 <?php if ( osc_count_subcategories() > ) { ?>
                   <ul>
                         <?php while ( osc_has_subcategories() ) { ?>
                             <li>
                             <?php if( osc_category_total_items() > ) { ?>
                                 <a class="category sub-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>
                             <?php } else { ?>
                                 <a class="category sub-category <?php echo osc_category_slug() ; ?>" href="#"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span>
                             <?php ?>
                             </li>
                         <?php ?>

and replace it with:

Code: [Select]
                    if ( osc_count_subcategories() > 0 ) { ?>
                    <span class="collapse resp-toogle"><i class="fa fa-caret-right fa-lg"></i></span>
                    <?php ?>
                    <?php if($_total_items 0) { ?>
                    <a class="category <?php echo $_slug?>" href="<?php echo $_url?>"><?php echo $_name ?></a> <span>(<?php echo $_total_items ?>)</span>
                    <?php ?>
                 </h1>
                 <?php if ( osc_count_subcategories() > ) { ?>
                   <ul>
                         <?php while ( osc_has_subcategories() ) { ?>
                             <li>
                             <?php if( osc_category_total_items() > ) { ?>
                                 <a class="category sub-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>
                             <?php ?>
                             </li>
                         <?php ?>

Regards

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: How to hide category and sub category when no classified is there
« Reply #3 on: February 01, 2015, 05:46:49 am »
OK thank you I will try and see