*

leuname07

  • **
  • 53 posts
Force list format for 1 category
« 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

*

leuname07

  • **
  • 53 posts
Re: Force list format for 1 category
« Reply #1 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">
          <?
        }
        ?>

Marked as best answer by frosticek on May 18, 2020, 02:58:24 PM
*

MB Themes

Re: Force list format for 1 category
« Reply #2 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.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots