Home / widget / Is sidebar widget active
  • How to Is sidebar widget active

    no thumbnail sorry: Is sidebar widget active

    Adding this PHP code to the sidebar.php for your wordpress theme will let you check if a sidebar widget is active if not display something else.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?php if ( function_exists('is_sidebar_active') && is_sidebar_active('sidebar') ) { ?>
        <div id="sidebar">
            <ul>
                <?php dynamic_sidebar('sidebar'); ?>
            </ul>
        </div>
    <?php }else{  ?>
        ..... no active widgets .....
    <?php } ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    dynamic_sidebar, _e, _ex,