Forum

Thread tagged as: Question, Problem, Addons

category list

Hi, I try to display a list of a particular category and it does not work for me. Thanks.

My template is:

<div class="col-md-3 col-sm-4 col-xs-6">
    <div class="category-item">
        <perch:categories id="animal-care" label="animal-care" set="animal-care" required="false"><a href="categoria/<perch:category id="catPath" />"> <perch:category id="catTitle" /></a>
        </perch:categories>
    </div>
</div>

and the function:

perch_content_custom('Empresa', array(
            'template' => 'empresa_listing_subcat03.html',
            'page'  => '/index.php',
            'category'   => 'animal-care/'
alex s

alex s 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you trying to display the content within that category? If so, your template will need to output some of it - at the moment you're just outputting the category title and a link.

alex s

alex s 0 points

Yes, this template is just to list links to the categories of a Set, but the problem is that the categories are repeated by the number of items in that category, I just want a list of categories of a Set for linking, view image.

error

Thanks Drew.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, so don't use perch_content_custom() as that's for displaying content. Use perch_categories() to display the categories.

alex s

alex s 0 points

Hi Drew, thanks. Mi function isn't working :(

perch_categories('Empresa', array(
            'template' => 'empresa_listing_subcat03.html',
            'page'  => '/index.php',
            'category' => 'animal-care'
));

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's because you've been making up syntax :)

https://docs.grabaperch.com/docs/categories/page-functions/

perch_categories(array(
    'set' => 'the-slug-of-your-category-set',
));
alex s

alex s 0 points

Brilliant Drew! Thanks again, great support.

perch_categories(array(
            'set' => 'the-slug-of-your-category-set',
            'template' => mytemplate-for-categories.html',