We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Listing only categories with assigned items (non-zero count)
Evening Perchers! I have a collection of houses, each of which is categorised by an activities / filter category (fishing, golf, etc) - Any idea how I can list only the categories that have been assigned to houses? i.e. those with a non-zero category count (for that collection?). I don't want empty categories appearing in the list as when the category link is clicked there are no houses to display.
Does this require an 'each' callback function? Any help or suggestions would be much appreciated!
perch_categories([ 'set' => 'category-filters', 'template' =>'category_filter_list.html', ]);
The category-filter-list.html template:
<perch:before><h2>Filter Houses ›</h2> <ul class="inline-list"></perch:before> <li><a href="/houses/category/<perch:category id="catSlug" type="slug" />"><perch:category id="catTitle" /></a></li> <perch:after></ul></perch:after>
Want to reply to this thread?Login with Perch