Home | About | Help Center | Privacy Policy

Try Our "Facebook App"

September 11th, 2009

How to hide a categories posts from Home page without using any plugin



Warning: Invalid argument supplied for foreach() in /home/blog/public_html/wp-content/plugins/buy-sell-ads/buy-sell-ads.php on line 415

Wordpress is full of possibilities and options but when you wants to use it as exclusive CMS then you need to consider few hacks and patch. There are  many contents on the CMS which is not required to display on the home page, do you have any idea how to fix it without plugins?

Today we are going to discuss a common hacks to hide a categories posts from Home page without any plugin. Follow the following listed process to hides the categories from posts

A normal index.php page of Wordpress theme (i took a default sandbox theme) looks like

<?php get_header() ?>

    <div id="container">
        <div id="content">

            <div id="nav-above" class="navigation">
                <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'sandbox' )) ?></div>
                <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox' )) ?></div>
            </div>

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

Post the below described code after the container (for your theme you can try to post it after header)

<?php if (is_home()) {
query_posts("cat=-ID");
}
?>

For excluding more than one categories use this code

<?php if (is_home()) {
query_posts("cat=-ID1,-ID2,-ID3,ID4");
}
?>

Where ID= your categories ID’s

Note: If  you don’t want to digg into code, use this awesome plugin named as Advanced Category Excluder which not only hides the posts from displaying on home page but can also hides the posts from search results, your RSS feed, your category, your recent post, and from web crawlers.



You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackbackfrom your own site.

Subscribe to our FREE Rss Feed

Hot in Social Media


10 Ways Social Media Can Help Your Business

10 Best Social Media Case Studies

10 Tips To Become Social Without Using Social Media

Top 10 Tips To Enhance Personal Branding

What's Hot

Similar Interesting Posts

Tutorials On

3 Responses to “How to hide a categories posts from Home page without using any plugin”

  1. How to hide a #wordpress categories posts from Home page without using any plugin http://bit.ly/2BeXB

  2. Tech How to hide a categories posts from Home page without any plugin: Wordpress is full of possibilities an.. http://bit.ly/Rzt0Y

  3. Nice post .. its always good learn simple things and not being reliable on the plugins.
    Hami´s last blog ..Listen to Free Bollywood Music On iPhone and iPod Touch My ComLuv Profile

Leave a Reply

CommentLuv Enabled

Additional comments powered by BackType

    Follow @honeytech On Twitter

    50 Unusual Examples of Concept Art http://bit.ly/ab0GG0
  • Subscribe For Tips


  • Top Fans Of The Day

  • Sponsors

Hot Tags

mobile Social media Firefox google Windows Designs tips WordPress Plugin iphone How to open source Linux Internet Social ubuntu Web design blogging mistakes free browser