Restrict front page categories
-
Hi,
I’m trying to restrict the categories that show up in the front page by adding
<?php query_posts("cat=-13"); ?>but I’m not sure where I should add it to. Here’s the main index php.<?php get_header(); ?> <div id="content"> <?php if(is_home()||is_front_page()) echo '<div class="spacer"></div>'; if (have_posts()) : $post = $posts[0]; // Hack. Set $post so that the_date() works. if(is_category()){ echo '<h3 class="archivetitle">Archive for the Category »'.single_cat_title('',FALSE).' «</h3>'; }elseif(is_day()){ echo '<h3 class="archivetitle">Archive for » '.get_the_time('F jS, Y').'«</h3>'; }elseif(is_month()){ echo '<h3 class="archivetitle">Archive for » '.get_the_time('F, Y').' «</h3>'; }elseif(is_year()){ echo '<h3 class="archivetitle">Archive for » '.get_the_time('Y').' «</h3>'; } elseif(is_search()){ echo '<h3 class="archivetitle">Search Results</h3>'; }elseif(is_author()){ echo '<h3 class="archivetitle">Author Archive</h3>'; }elseif(isset($_GET['paged']) && !empty($_GET['paged'])){ // If this is a paged archive echo '<h3 class="archivetitle">Blog Archives</h3>'; }elseif(is_tag()){ echo '<h3 class="archivetitle">Tag-Archive for » '.single_tag_title('',FALSE).' « </h3>'; } while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="post_date"><div class="post_date_day"><?php the_time('d');?></div><div class="post_date_month"><?php the_time('M');?><br /><?php the_time('Y');?></div></div> <div class="post_title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <div class="post_author">By <?php the_author_posts_link('nickname'); ?> <?php edit_post_link(' Edit ','(',') '); ?></div> </div> <div class="clear"></div> <div class="entry"> <?php if (is_search()){ the_excerpt(); }else{ the_content('more...'); } ?> <div class="clear"></div> </div> <div class="info"> <span class="category">Category: <?php the_category(', ') ?></span> <?php the_tags(' <span class="tags">Tags: ', ', ', '</span>'); ?> <span class="bubble"><?php comments_popup_link('Leave a Comment','One Comment', '% Comments', '','Comments off'); ?></span> </div> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> </div> <?php else : ?> <h3 class="archivetitle">Not found</h3> <p class="sorry">"Sorry, but you are looking for something that isn't here. Try something else.</p> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer();?>I’ve tried adding it after
<?php get_header(); ?>and before<div id="content">and it works, but then I after that when I click a specific category, the front page does not change.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Restrict front page categories’ is closed to new replies.