ACE - 2

Sometimes there comes a specific time when you want to exclude certain categories from WP homepage. It means that you don’t want some specific categories to appear on your site’s homepage. The thing sometimes just due to requirements which come in front of you or sometimes as you wishes to experiment the things at an extra par. In this article we talk about two ways by which you can achieve the action – one by using the plugin and second by going onto the manual way.

Using The Plugin: Advanced Category Excluder

The plugin works as a content separator, content manager, content excluder, and sidebar widget manager plugin to enable CMS like functionality. The plugin works on its main goal: to enhance WordPress functionalities, to hide some unwanted categories, from defined parts of the blog.

More Info | Download

Manual Way

  • Make sure you keep a note of the category you want to exclude.
  • Now open your “index.php” file with the editor.
  • You need to search for the code line: <? PHP if (have_posts ()) : while (have_posts ()) : the_post (); ?>
  • On finding the required code line, now put the following code before that line: <? PHP if ( is_home () ) { query_posts ( ‘cat=-X’ ); } ?> ; where X represents the category id of your directory.
  • If you want to exclude various categories, you just need to put a comma and type other id after that. It can be like this: <? PHP if ( is_home () ) { query_posts ( ’cat=-X, -Y, -Z’ ); } ? > ; where X, Y, Z represents various IDs of your directories.
  • Now select the option “Update” and you are done.