Support » Themes and Templates » Sidebar widgets only work with a typo?!

  • Resolved pau1w


    I have a very strange problem with a theme I’m currently developing – I registered some widget-ready areas and they all work fine, but then I realised I’d made a typo..

    <?php if ( function_exists('dynamic_<strong>sider</strong>bar') || dynamic_sidebar('Footer Area 1') ) : else : ?>

    I’d typed ‘dynamic_siderbar’, obviously instead of ‘dynamic_sidebar’.

    But when I correct this typo, the widgets no longer work. I’ve tried registering them completely from scratch but they still only work with the typo.

    I’m gonna be selling this theme, as well, so I’d really like the damn things to work properly so there’s no problems for other people.

    Any ideas?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael


    Forum Moderator

    ‘normally’ the if statement is in the negated form:

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?>
    static code here
    <?php endif; ?>

    in your case, I would try and make the if statement with && (AND) :

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Footer Area 1') ) : else : ?>
    static code here
    <?php endif; ?>

    looking into the sidebar code of Twenty Ten, it can probably be safe to assume that one does not need to check the existance of function_exists('dynamic_sidebar') anymore with wp3.

    That worked. Much appreciated, mate.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sidebar widgets only work with a typo?!’ is closed to new replies.