Osclass Support Forums
Osclass theme support => Beta Osclass Theme => Topic started by: leuname07 on May 17, 2020, 02:42:47 AM
-
Hello,
How to force the view of ads in list format only for one category and the rest in grid format.
Thank You
-
It's OK, i make this in search.php
<?php
$adseros = array("110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120");
if (in_array(osc_category_id(), $adseros)) { ?>
<div class="products list"> <?php
}
else
{
?>
<div class="products grid">
<?
}
?>
-
@leuname07
Better would be to update def view variable (it's from starter theme).
$def_view = osc_get_preference('def_view', 'starter_theme') == 0 ? 'gallery' : 'list';
$def_view = (in_array(osc_category_id(), array(1,2,3,4,5)) ? 'list' : 'grid');
It will have no impact on user selection of view type.