If you are using the WordPress platform for your blog and want to exclude the posts of some certain categories then this article may sound well.There are too many ways that help to exclude the posts of a certain category. But I’ll discuss the most appropriate ways that works generally. One important thing you should remember that never try it in hurry. Follow every thing carefully I discussed ( read also : How To Install Your WordPress Blog In Wamp Server). Always take a backup of all of your theme templates before editing them because if you mess up then you can restore the back up.
1.Exclude the post of a certain category by editing the template
You can exclude the post of any category using Query_posts function.For example let us say that you want to exclude the posts from the category with category ID 4. Just open the template named index.php from the theme folder and look for the line
< ?php if (have_posts()) : ?>
Now add this before the line mentioned above.
<?php query_posts($query_string . “&cat=-4″); ?>
By the above process you can exclude undesired category posts from your home page.
To know the category ID just hover the mouse pointer on the Category name in the category list in your WordPress dashboard,the id will appear in the status bar.
There is one back draw of this process.If a post is published under multiple categories then the post will be still visible in the home page.You can avoid this if you post the article which you want to exclude from home page in just one category.
2.Exclude the post of a certain category using WordPress plugin
There is a smart WordPress plugin that allows you to exclude posts from a certain category.
- Download the Front Page Excluded Categories plugin and upload it in the plugin folder under wp-content.
- Now activate it from the WordPress Dashboard.
- Open the plugin Editor and Select the “FrontPage excluded Categories” for Editing.Find for the line
Now include the category ID of which you want to exclude the posts from appearing in the home page.
Now you have done.
Tell us which process you prefer to use. Feel free to share with us.