exclude categories from homepage
-
Hi all I want to exclude three categories form my homepage, I am using the following code:
<?php get_header(); ?> <div id="content"> <div id="feat_section"> <?php if (have_posts()) : ?> <!---FEATURE LOOP STARTS---> <?php query_posts('cat=5&showposts=1'); $ids = array(); while (have_posts()) : the_post(); $ids[] = get_the_ID(); ?> <div class="feat_title"> <div class="feat_title"> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> </div> <div class="post_author"> <p>By: <?php the_author_posts_link(); ?> | <?php the_date(); ?> | <?php the_time(); ?></p> </div> <div class="entry"> <?php if( get_post_meta($post->ID, "thumb", true) ): ?> <div class="homethumb"> <img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=350&w=624&zc=0" alt="<?php the_title(); ?>" width="624" height="350" /> </div> <?php else: ?> <?php endif; ?> </div> </div> <?php endwhile; ?> </div> </div> <!---FEATURE LOOP END---> <!---NEWS - LEFT COLUMN LOOP START---> <div id="news_section"> <div id="column_01"> <?php query_posts('showposts=15'); ?> <?php $posts = get_posts('numberposts=15&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "15") { break; } else { ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <?php if( get_post_meta($post->ID, "homeimg", true) ): ?> <div class=”homeimg”> <img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "homeimg", $single = true); ?>&h=223&w=297&zc=0" alt="<?php the_title(); ?>" width="297" height="223" /> </div> <?php else: ?> <?php endif; ?> <div class="entry"> <?php the_excerpt(); ?> </div> </div> <?php $count2++; } ?> <?php endforeach; ?> </div> <!---NEWS - LEFT COLUMN LOOP ENDS---> <!---NEWS - RIGHT COLUMN LOOP START---> <div id="column_02"> <?php query_posts('showposts=15'); ?> <?php $posts = get_posts('numberposts=15&offset=15'); foreach ($posts as $post) : start_wp(); ?> <?php static $count3 = 0; if ($count3 == "15") { break; } else { ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <?php if( get_post_meta($post->ID, "homeimg", true) ): ?> <div class=”homeimg”> <img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "homeimg", $single = true); ?>&h=223&w=297&zc=0" alt="<?php the_title(); ?>" width="297" height="223" /> </div> <?php else: ?> <?php endif; ?> <div class="entry"> <?php the_excerpt(); ?> </div> </div> <?php $count3++; } ?> <?php endforeach; ?> </div> </div> <!---NEWS - RIGHT COLUMN LOOP ENDS---> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
I have tried adding
&cat=-5,-16
to the query_posts string, but this is not working. Can anyone help.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘exclude categories from homepage’ is closed to new replies.