Daniel Ngo
asked 9 years ago

Hi,
I’m trying to exclude category ‘Events’ from appearing in the home feed. I’m aware that you can filter categories via the customise options, but the post has two categories applied to it. It won’t show if I only had a single category but in this scenario, a multicategory post is needed.
Is there a way to accomplish this through the WP Admin panel? or if there are other coding suggestions I am open to hear them.
Thanks

1 Answers
Wilfred
answered 9 years ago

Hi Daniel,  To resolve this issue please follow my instruction here:
–  Go Dashboard / Posts / Categories / Events. Get ID of this category (see this image)
– Open Home.php file in /wp-content/themes/dw-wallpress/home.php
– Replace following code – line 9

$wp_query = new WP_Query( 'cat='.implode(',', $cat_arr).'&paged=' . $paged );

with: 

$wp_query = new WP_Query( 'cat='.implode(',', $cat_arr).'&paged=' . $paged . '&category__not_in=CAT_ID' );

Replace CAT_ID by Category ID.

Hope thís helps!

Powered by DW Question & Answer Pro