Osclass Support Forums

Osclass theme support => Beta Osclass Theme => Topic started by: leuname07 on May 17, 2020, 02:42:47 AM

Title: Force list format for 1 category
Post 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
Title: Re: Force list format for 1 category
Post by: leuname07 on May 17, 2020, 10:32:16 PM
It's OK, i make this in search.php

Code: [Select]
          <?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">
          <?
        }
        ?>
Title: Re: Force list format for 1 category
Post by: MB Themes on May 18, 2020, 02:58:17 PM
@leuname07
Better would be to update def view variable (it's from starter theme).
Code: [Select]
$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.