Forum

Thread tagged as: Question, Problem

Filter Category Images

I want to show 6 category images on the home page...

[Screenshot] (https://www.evernote.com/l/ABUeHOqoCANMYIYqtF0mVoFSp4Iux6iicTU)

I've created a check box in the category...

<perch:category id="display_homepage" type="checkbox" label="Show on home page" value="1" />

And filter this check box using...

<?php perch_categories(array(
    'template'=>'_category_image_feed.html',
    'set'=>'Products',
    'filter'=>'display_homepage',
    'match'=>'eq',
    'value'=>1
)); ?>

But using this "nothing" displays on the home page (and the checkbox is ticked in admin). If I remove the filter the images show.

Where am I going wrong?

David Owen

David Owen 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Categories don't currently have filters for dynamic fields. It's on the roadmap to change for Perch 2.9.

ah! ok.

Until 2.9 comes out is there any way of displaying only the first 6 categories listed?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can use count, and you can filter on any of the fixed fields.

Got it...

<?php perch_categories(array(
    'template'=>'_category_image_feed.html',
    'set'=>'Products',
    'count'=>6
)); ?>