php - WordPress sidebar: appear only on certain pages -
how can edit php wordpress sidebar appear on select pages (i.e. not on home , pages)?
i'd prefer php on css if possible.
you can use function is_page() in template , rendering sidebar if need to.
small example, in sidebar.php
of twentyten theme of wordpress
<div id="secondary" class="widget-area" role="complementary"> <ul class="xoxo"> <?php if (is_page('my-page')) { dynamic_sidebar( 'secondary-widget-area' ); } ?> </ul> </div><!-- #secondary .widget-area -->
this little snippet outputs sidebar if in page has slug 'my-page'.
hope helps!
Comments
Post a Comment