[Resolved] Exluding post categories from query_posts by name/slug with get_cat_ID
Hi there, I have a custom loop for my blog page that Id like to allow “all” other categories aside from “events” to be visible in that particular feed…Im using the get_query_var($paged) trick to help maintain paging within query posts…anyways, since wordpress doesn’t afford you the luxury of directly excluding a category via name/slug instead of ID, it appears that using get_cat_ID is the solution, however I cant seem to amend my code properly in order for it to work.
My goal is to simply show all posts with any category other then “events” basically….Heres my current code:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("category_name=blog&paged=$paged"); ?>
As you can see, right now its only allowing posts with the category “blog” to show up, and thats fine, but ideally Id like to just exclude the “events” category and allow all others with get_cat_ID.
Hope that was enough info and I explained it clear enough, thanks for the help.
- The topic ‘[Resolved] Exluding post categories from query_posts by name/slug with get_cat_ID’ is closed to new replies.