Hide your secret files INSIDE photos, videos or other files with OmniHide PRO.

Exclude categories from wordpress frontpage


Protect your eyes !

I stumbled upon this when Blogulate.com’s first post was made. I didnt want the Blog Reviews to appear on the homepage.

This is actually very simple. All you have to do is modify some PHP code.

First, goto Manage > Categories and get the ID of the Category you wish to exclude. Then, go to WP admin and selet Presentation > Theme Editor ..

For your current theme, edit the loop where the posts are displayed. (It varies according to the theme… It was theloop.php for my K2 theme. )

Here is the sample from K2 Theme’s post display loop.

<?php /* Start the loop */ while ( have_posts() )

{

the_post();

?>

MODIFIED CODE :

<?php /* Start the loop */ while ( have_posts() )

{

the_post();

if (is_home()) if (in_category(“14”)) continue;
if (is_home()) if (in_category(“47”)) continue;

?>

The modified code doesnt show posts that belong to Categories 14 and 47 in homepage.

 
Discover upcoming movies
 

42 responses to “Exclude categories from wordpress frontpage”

 
 

Categories