Advertisement:

Author Topic: Veronika MB Theme - Only 5 categories icons in top navigation  (Read 203 times)

leuname07

  • Newbie
  • *
  • Posts: 39
Hello all,

Hello,

I have a lot of categories. But in the homepage, i just want the principal categories with this ID :

110
99
105
107

and one button "All Categories" with the same design.

this is the code in inc.category.php veronika theme

Code: [Select]
<div class="top-cat-wrap sc-block<?php if(osc_get_preference('search_box_home''veronika_theme') <> '1') { ?> border-top<?php ?>">

    <?php if((osc_is_search_page() && ($search_cat_id <= || $search_cat_id == '')) || !osc_is_search_page()) { ?>
      <div id="top-cat">
        <div class="cat-inside">
          <div class="top-cat-ul-wrap">
            <div class="left-arrow arrows tr1 noselect"><i class="fa fa-angle-left tr1"></i></div>

            <div class="ul-box">
              <ul <?php if(osc_is_search_page()) { ?>class="ul-search"<?php ?> style="width:<?php echo osc_count_categories()*130?>px">
                <?php while ( osc_has_categories() ) { ?>
                  <?php $search_params['sCategory'] = osc_category_id(); ?>
                  <?php 
                    
if($root_cat_id <> '' and $root_cat_id <> 0) {
                      if(
$root_cat_id <> osc_category_id()) { 
                        
$cat_class 'cat-gray';
                      } else {
                        
$cat_class 'cat-highlight';
                      }
                    } else {
                      
$cat_class '';
                    }

                    
$color veronika_get_cat_color(osc_category_id());
                  
?>

Any help to make this change ?

Thank you all !

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Veronika MB Theme - Only 5 categories icons in top navigation
« Reply #1 on: May 01, 2019, 08:12:53 pm »
Hello,

Try this:

Code: [Select]
<?php $allowed_categories = array(110,99,105,107); ?>
<div class="top-cat-wrap sc-block<?php if(osc_get_preference('search_box_home''veronika_theme') <> '1') { ?> border-top<?php ?>">
    <?php if((osc_is_search_page() && ($search_cat_id <= || $search_cat_id == '')) || !osc_is_search_page()) { ?>
      <div id="top-cat">
        <div class="cat-inside">
          <div class="top-cat-ul-wrap">
            <div class="left-arrow arrows tr1 noselect"><i class="fa fa-angle-left tr1"></i></div>

            <div class="ul-box">
              <ul <?php if(osc_is_search_page()) { ?>class="ul-search"<?php ?> style="width:<?php echo osc_count_categories()*130?>px">
                <li>
                  <a id="cat-link" href="<?php echo osc_search_url(); ?>" title="Show all ads.">
                    <div class="img">
                      <span style="background:#F44336;"></span>
                        <i class="fa fa-newspaper-o" style="color:#F44336;"></i>
                    </div>
                    <div class="name">All categories</div>
                  </a>                 
                </li>
                <?php while ( osc_has_categories() ) { ?>
                  <?php if(!in_array(osc_category_id(), $allowed_categories)) continue; ?>
                  <?php $search_params['sCategory'] = osc_category_id(); ?>
                  <?php 
                    
if($root_cat_id <> '' and $root_cat_id <> 0) {
                      if(
$root_cat_id <> osc_category_id()) { 
                        
$cat_class 'cat-gray';
                      } else {
                        
$cat_class 'cat-highlight';
                      }
                    } else {
                      
$cat_class '';
                    }

                    
$color veronika_get_cat_color(osc_category_id());
                  
?>


You can change the icon and background color for all categories button.

Regards.

leuname07

  • Newbie
  • *
  • Posts: 39
Re: Veronika MB Theme - Only 5 categories icons in top navigation
« Reply #2 on: May 02, 2019, 12:46:20 pm »
You're the BEST !

Thank you !

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Veronika MB Theme - Only 5 categories icons in top navigation
« Reply #3 on: May 02, 2019, 01:05:42 pm »
You're welcome. :)

leuname07

  • Newbie
  • *
  • Posts: 39
Re: Veronika MB Theme - Only 5 categories icons in top navigation
« Reply #4 on: May 02, 2019, 02:19:31 pm »
I have juste one probleme with the link "all categories".

warning: count(): Parameter must be an array or an object that implements Countable in oc-includes/osclass/helpers/hSearch.php on line 342 http://www.mywebsite.com/index.php?page=search

leuname07

  • Newbie
  • *
  • Posts: 39
Re: Veronika MB Theme - Only 5 categories icons in top navigation
« Reply #5 on: May 02, 2019, 03:44:06 pm »
Ok. i have replace with the link directly and it's ok.

Thank you.

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Veronika MB Theme - Only 5 categories icons in top navigation
« Reply #6 on: May 02, 2019, 05:49:04 pm »
You're welcome.

A possible fix is to use osc_search_url(array()); instead of osc_search_url().

Regards.