Hide confidential files INSIDE other image, music or video files!
Powered by MaxBlogPress 

Nov
12

Exclude categories from wordpress frontpage

posted by thinkdj at 6:02 pm in PHP,Tips n Tricks,Tweaks,Wordpress

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.

28 Responses to “Exclude categories from wordpress frontpage”

  1. We enjoy this site given and it has presented me several sort of inspiration to have success for some good reason, so thank you.

  2. Worked like a charm on my site Best Date Night Ideas! This solution did exactly what I wanted it to. Thanks a ton for posting this.

  3. Fantastic information in your post, I saw this report on television yesterday about this same thing and since I am getting married in two weeks and the timing could not have been better! thanks for the info!, I have bookmarked, thanks Rayford Mahler

  4. daster68er says:

    http://yaycacudby.livejournal.com/ – Скачать фильм Наша Russia Яйца судьбы онлайн

  5. Mega Rick says:

    Cool, thanks! Exactly what I needed.

Leave a Reply

Snippets from the web featuring Technology, Gadgets, Gaming, Downloads and Industry news.

 Subscribe in a reader


Categories

open all | close all