[Thesis]: Hidden Category At Home

Sometimes, you want the articles in Category ABC do not appear in the homepage for any reason. ProBlogTip will guide you to do this without installing any additional plugin.



Note: The article used only Thesis theme.

Open custom_function.php file, insert the following code:


/* Hidden Category At Home - http://www.problogtip.com */
function home_filter_begin() {
if(is_home()):
global $wp_query;
$exclude = '-category 1,-category 2,-category 3,-category 4,-category 5';
query_posts(array_merge(array('cat' => $exclude ),$wp_query->query));
endif;
}
add_action('thesis_hook_before_content','home_filter_begin');

function home_filter_end() {
if(is_home()):
wp_reset_query();
endif;
}
add_action('thesis_hook_after_content','home_filter_end');

You change the category 1, category 2... in the next section of the Category ID that you want to filter.


$exclude = '-category 1,-category 2,-category 3,-category 4,category 5';


- Category ID, go to http://domain/wp-admin/categories.php

Comments

Popular posts from this blog

Giveaway: Google Music Invites

Skype 2.25 and Qik Fliks Come to Windows Phone

Black Friday & Cyber Monday 2015