Is there a new way to register widgets for WP 3.3?

I made the big switch to WP 3.3...and now a lot of my plugins no longer work.

Strangely, the three footer widgets I had no longer show up either.

I had put them into the function.php of my child theme of Edu Clean 2.2.3.

Is there a new way do register widgets in WP 3.3?

  • katypurviance
    • Site Builder, Child of Zeus

    Hi Barry,

    Could you tell me more about

    the use of extending the the widget class

    What do I need to know in order to redo my three footer widgets? Is there a resource about this you could point me towards?

    Right now, this is how I have it:

    In functions.php:

    <?php
    
    ////////////////////////////////////////////////////////////////////////////////
    // register widget
    ///////////////////////////////////////////////////////////////////////////////
    function edus_child_widgets_init() {
    global $bp_existed;
    register_sidebar(array(
    'name'=> __('Home Side Left', TEMPLATE_DOMAIN),
    'id' => __('home-side-left', TEMPLATE_DOMAIN),
    'description' => __('Home Side Left Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array(
    'name'=> __('Home Side Right', TEMPLATE_DOMAIN),
    'id' => __('home-side-right', TEMPLATE_DOMAIN),
    'description' => __('Home Side Right Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array(
    'name'=> __('Sidebar', TEMPLATE_DOMAIN),
    'id' => __('sidebar', TEMPLATE_DOMAIN),
    'description' => __('Sidebar Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    if($bp_existed == 'true') {
    register_sidebar(array(
    'name'=> __('Member Sidebar', TEMPLATE_DOMAIN),
    'id' => __('member-sidebar', TEMPLATE_DOMAIN),
    'description' => __('Member Sidebar Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array(
    'name'=> __('Footer Left', TEMPLATE_DOMAIN),
    'id' => __('footer-left', TEMPLATE_DOMAIN),
    'description' => __('Footer Left Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array(
    'name'=> __('Footer Center', TEMPLATE_DOMAIN),
    'id' => __('footer-center', TEMPLATE_DOMAIN),
    'description' => __('Footer Center Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array(
    'name'=> __('Footer Right', TEMPLATE_DOMAIN),
    'id' => __('footer-right', TEMPLATE_DOMAIN),
    'description' => __('Footer Right Widget', TEMPLATE_DOMAIN),
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }
    }
    add_action( 'widgets_init', 'edus_child_widgets_init' );
    
    ?>

    In footer.php:

    <div id="footer-left">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-left') ) : ?>
    <?php endif; ?>
    </div>
    
    <div id="footer-center">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-center') ) : ?>
    <?php endif; ?>
    </div>
    
    <div id="footer-right">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-right') ) : ?>
    <?php endif; ?>
    </div>

    And then, of course, I have some css for them as well.

    What should I do instead?

  • Barry
    • DEV MAN’s Mascot

    Ah sorry, I thought you were asking if there was a new way to code widgets not sidebars? Sidebars are the same I think - are those areas not showing up in the Widgets menu admin page?

    I usually check the default theme for WP to see if things have changed :slight_smile: The code in twenty eleven is:

    register_sidebar( array(
    		'name' => __( 'Main Sidebar', 'twentyeleven' ),
    		'id' => 'sidebar-1',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    So yours does look ok to me from a quick glance through.

  • katypurviance
    • Site Builder, Child of Zeus

    No, my custom widgets no longer show up in the Widgets menu admin page. I'm not sure how to edit my code to make them re-show up.

    After testing some of my no-longer-working plugins in a less complicated theme, I'm starting to think that Edu Clean + WP 3.3 just doesn't play well with many other things. This is a real pity because I really like this theme.

  • Barry
    • DEV MAN’s Mascot

    No, my custom widgets no longer show up in the Widgets menu admin page. I'm not sure how to edit my code to make them re-show up.

    Hi, you've got me a little bit confused now. Do you mean custom widgets, or custom sidebars? Because the code you posted above is for registering sidebars not widgets.

  • katypurviance
    • Site Builder, Child of Zeus

    Sorry. I had registered three additional widget areas to put in my footer. The other widget areas that you see in my code were part of EduClean's parent function.php that I included in my child function.php so that I could make sure that I kept them. The original code used the terminology "register_sidebar" for each of its widget areas, so that's what I used for mine, even though it does seem to be a misnomer.

    It was working until I switched to WP 3.3.

    What do I do?

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    Just checking if it was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, could you let us know by re-opening this topic, and we'll get onto it and helping you out asap!
    Otherwise, happy days, glad you got it sorted :slight_smile:

    Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.