Help with excluding category?
-
I’m going nuts trying to figure out what I’m doing wrong here- I know there are a ton of other posts regarding similar situations, and I’ve sorted through many of them and tried almost everything I could come across to no avail.
I have a separate template for a blog page, and within that template, I want to exclude category 3- as that is driving a homepage carousel.Here is what I have in ‘Blog_template.php’
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $categories=get_categories(); foreach($categories as $category) { $option .= $category->term_id.','; } $option .= '1'; query_posts('cat='.$option.'&paged='.$paged); if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="top-inner"> <h1><?php the_title();?></h1> <ul> <li><span><i>by <?php the_author(); ?> on </i><?php the_time('F j S, Y') ?></span></li> <li class="last"><?php the_category(', ') ?></li> </ul>I’ve unsucessfully tried:
$categories=get_categories('-3');
and also:
query_posts('cat=-3'.$option.'&paged='.$paged);Am I missing something or would anyone have any direction for me?
Thanks so much for the time!
The topic ‘Help with excluding category?’ is closed to new replies.