Forum

Thread tagged as: Runway, Blog

Filter blog categories by Section

Hi,

I'm trying to output a list of of all Categories used within a specific blog section.

I've tried to use the following, but this outputs all the categories used in the entire blog (and not just the ones used in this particular section).

<?php
        perch_blog_categories(array(
        'section' => 'en'
    ));
?>

I've found a couple of similar forum posts that seem to show that I may not be able to filter categories by section in this way (https://forum.grabaperch.com/forum/06-27-2016-blog-sections-filter-by-categories and https://forum.grabaperch.com/forum/03-30-2015-cant-get-perch-blog-categories-to-filter-by-section). Is this the case?

My use case is a blog in various languages, and each language will have its own set of Categories. Given that I need to show the categories in use by each language, what would you recommend as an approach? Would multiple blogs (this is a Runway project) and then filtering by blog be the best option here?

Many thanks in advance for your help.

Simon Kelly

Simon Kelly 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not entirely sure how those are calculated so I'd need to try it to find out. You might be in a position to try that quicker than me, but if not, I'll see what I can do.

Hi Drew,

Would you expect my example to work, or am I misunderstanding the filtering with section?

I'll give multiple blogs a go too, but sections would be nice if possible.

Thanks for your help.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't have enough familiarity with it to know if it should work or not - I'll take a look into it.

Hi Drew,

Just to confirm what I'm seeing here in case it's of any help, filtering perch_blog_categories() by blog (in the case of multiple blogs) does output the categories in use by that specific blog, but the same doesn't work when filtering by section.

Thanks again for your help.