Post Pic

How to: Remove widget areas on your blog homepage without editing template files

Ever wanted to be able to remove your widgetized areas (Sidebar, most of the time) on your blog homepage, but don’t feel like editing your theme files? No problem, here is the solution.

To do so, simply add the following code to your functions.php file:

<?php
add_filter( 'sidebars_widgets', 'disable_all_widgets' );

function disable_all_widgets( $sidebars_widgets ) {
	if ( is_home() )
		$sidebars_widgets = array( false );
	return $sidebars_widgets;
}
?>

That's all, no more widgetized areas are displayed on your homepage.

Credits goes to Justin Tadlock for this awesome recipe!

9 Responses

Mar 09 2009 17:43

Thanks for sharing great recipe.

Mar 10 2009 00:53

Nice tip to bypass edition of index file. Thanks for sharing.

Mar 10 2009 06:48

That’s easy to follow and save a lot of time.

Mar 12 2009 20:02

Nice, I know with my niche sites, widgetized sidebars sometimes get in the way. Nice tip.

Apr 01 2009 15:22

Sweet & simple ;)

Apr 07 2009 17:10

hmm… thank you

Jul 29 2009 21:57

Hmmmm. This didn’t work for me. The widgets still show up. Is there a way to do this by excluding certain ID’s?

I am using the Vina templete. How do I determine if there is a default setting in the template?

I’d appreciate the help sooooo much!

Thanks,

Zak

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required