How to Hide a WordPress Sidebar From Pages

December 22, 2009

In combination with my previous post on adding multiple sidebars to a WordPress theme, I had the need to display one of them only when looking at the blog part of wordpress. This is pretty straightforward, but basically we just need to check if we are not on a page and display the sidebar.

//If we are viewing posts, not a page, print the posts sidebar
if(!is_page())
{
	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Posts Sidebar') ):
	endif;
}

Stay in Touch!

Subscribe to our newsletter.

Solutions Architecture

browse through our blog articles

Blog Archive