Osclass forums
Development => Development => Topic started by: proclass on May 09, 2012, 01:43:47 pm
-
I have more then 50 categories (per 3-4 Subcategory). On first(home) page need only 9-12 Categories.
For subcat (but don't work for main categories) :
http://forums.osclass.org/development/show-only-the-first-5-subcategories-per-category-possible/
Thank you for help
-
try this one
Locate these line in main.php
while ( osc_has_categories() ){
Replace the above line with this
while ( osc_has_categories() ){
if(osc_category_name()=="Vehicles"||osc_category_name()=="Real estate")
the above code shows only 2 categories fields(Vehicles,Real estate) and change code to show extra categories whatever you want
-
unfortunately don't work
-
If you only want to show a certain number of categories, just set a variable up to count the number of categories being displayed. Then once you've reached your desired number of categories to display, stop.
Such as...
index = 0;
while ( osc_has_categories() && index < 12)
{
...
...
index++;
}
Change '12' to however many categories you wish to show.
-
Sorry my Code is orginal modern Theme. i want display has_category 9 and has_subcategorys 2. Please can post the code fpr me?
Thank you.
<?php while ( osc_has_categories() ) { ?>
<div class="category">
<h1><strong><a class="category cat_<?php echo osc_category_id() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></strong></h1>
<?php if ( osc_count_subcategories() > 0 ) { ?>
<ul>
<?php while ( osc_has_subcategories() ) { ?>
<li><a class="category cat_<?php echo osc_category_id() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php
if (($col==1 && $i==$col1_max_cat) || ($col==2 && $i==$col2_max_cat) || ($col==3 && $i==$col3_max_cat)) {
$i = 1;
$col++;
echo '</div>';
if($x < $total_categories) {
echo '<div class="col c'.$col.'">';
}
} else {
$i++ ;
}
$x++ ;
?>
<?php } ?>
-
Hi jeller,
All you have to do is change line 57 $total_categories = osc_count_categories() ; to this $total_categories = 9 ; and then you will only have 9 categories loaded on the home page.
Jay