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

    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

    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

    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?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.