Forum
Filtering Blog posts by category
Hi,
I need to display all blog posts except those with the category 'logistics'.
I have the following code for the listing page:
<?php
perch_blog_custom(array(
'sort' => 'postDateTime',
'sort-order'=>'DESC',
'count'=>'5',
'category' => array('!blog/logistics'),
'template'=>'blog/post_in_list.html',
));
?>
If a post is given the category 'logistics' it is excluded from the listing as expected. However, if no posts are assigned the category 'logistics' nothing displays in the listing at all.
Is there a way to make all posts display when no category has be assigned? Like checking for an empty category perhaps?
Can you show me the debug output when this happens?
Sure...
Ok, thanks, I'll see if I can fix it.
Hi Drew,
Just updated the site to 2.8.17 and it seems to have fixed the issue. I saw that you had a note - Fixes bug with negative category filtering - was this the fix?
Yes, that's the fix!
Brilliant - great work Drew, thanks!