开发者

wordpress, detecting number of widets inside a div

i am using wordpress and have come at a point that i have to hide the div if开发者_如何学Python there is no widget displayed in it.

can some one tell me the code for detection of number of widgets displayed in a specific area.


try this

<?php if ( is_active_sidebar( 'your-widget-area' ) ) : ?>
<!--This div will not display if there is no active widgets
     so place your div inside if condition-->
 <div>

<?php dynamic_sidebar( 'your-widget-area' ); ?>

 </div>        
<?php endif; ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜