Forum

Thread tagged as: Question, Blog

Radio button ON/OFF on perch to disable post categories

Hi, I have created a radio button inside Perch panel to hide/show all header elements on www.inakidomingo.com (it works fine). — Now I would like to not show those posts from OFF categories. Any idea?

Header's switch template

<perch:content id="switcher" type="radio" label="Show/Hide header elements" options="ON|display-inline-block, OFF|display-none" />

Header code

<ul>
  <li class="<?php perch_content('Switch-work'); ?>"><a href="/work" class='nav-work'>Work</a></li>
  <li class="<?php perch_content('Switch-editorial'); ?>"><a href="/editorial" class='nav-editorial'>Editorial</a></li>
  <li class="<?php perch_content('Switch-curatorial'); ?>"><a href="/curatorial" class='nav-curatorial'>Curatorial</a></li>
  <li class="<?php perch_content('Switch-educational'); ?>"><a href="/educational" class='nav-educational'>Educational</a></li>
  <li class="<?php perch_content('Switch-info'); ?>"><a href="info" class="nav-info contact">Info</a></li>
</ul>

Grid item template

<li class='grid-item <perch:categories id="categories" set="blog" label="Tipo de album"> <perch:category id="catTitle" /></perch:categories> percher'>
    <a href='/o.php?s=<perch:blog id="postSlug" />'>
        <img src='<perch:blog id="portada" type="image" label="Imagen de portada" help="Reduce a 400px x 400px" width="400px" height="400px" crop="true" />' alt='<perch:blog id="postTitle" />' title='<perch:blog id="caption" type="text" label="Caption" />' onload="imgLoaded(this)" />
        <h3><perch:blog id="postTitle" /></h3>
    </a>
</li>

Index grid

<ul class="grid">

                <?php 
                    perch_blog_custom(array(
                     'filter' => 'highlight',
                     'match' => 'eq',
                     'value' => 'true',
                     'sort' => 'postDateTime',
                     'sort-order'=> 'DESC',
                     'count'=> 2000000,
                     'template'=> 'grid-item.html',
                     ));

                    perch_blog_custom(array(
                     'filter' => 'highlight',
                     'match' => 'neq',
                     'value' => 'true',
                     'sort' => 'postDateTime',
                     'sort-order'=> 'DESC',
                     'count'=> 2000000,
                     'template'=> 'grid-item.html',
                     ));
                 ?>
Raul Serrano

Raul Serrano 0 points

  • 3 years ago

Any idea?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I really don't understand your question.

I need my client to be able to hide/show sections on header, and in consecuence in home page's grid. Those sections are blog categories. I just created that switch button to hide/show header elements, but I am not able to tell home's grid to only choose those categories that are switched as ON (visible)