Osclass forums
Support forums => Themes => Topic started by: leuname07 on May 01, 2019, 05:39:30 pm
-
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
<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 <= 0 || $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 !
-
Hello,
Try this:
<?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 <= 0 || $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.
-
You're the BEST !
Thank you !
-
You're welcome. :)
-
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
-
Ok. i have replace with the link directly and it's ok.
Thank you.
-
You're welcome.
A possible fix is to use osc_search_url(array()); instead of osc_search_url().
Regards.