WordPress: Exclude Category from Front Page – Still Show in Sidebar?

simpleinbound WP Wordpress: Exclude Category from Front Page   Still Show in Sidebar?This method will allow you to have a category “ONLY” appearing in your sidebar but excludes posts from the front page

1- Added this code to “index.php
(Notes: category # says -20, this # is the category I dont want on the front)
(also this needs to appear in your code before the loop)

(my excluded Category was 20, for more than one category use: -3,-20 (separate your categories with commas!)

2- Add the following code to your “index.php” file, but before the Loop

<?php query_posts($query_string . ‘&cat=-20′); ?>

This code will now exclude that category #20 from your home page posts BUT can be used to show up in one of yoru side bar plugins

————————————————————————–
Additional Notes:

your loop code may already say loop or something like the following

 <?php if (have_posts()) : ?>

or

 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

pixel Wordpress: Exclude Category from Front Page   Still Show in Sidebar?
Be Sociable, Share!
  • more Wordpress: Exclude Category from Front Page   Still Show in Sidebar?
This entry was posted in Wordpress and tagged , , , . Bookmark the permalink.
If you would like to stay current on our Inbound Marketing Techniques, make sure to:
Subscribe to the RSS Feed!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>