WordPress Widget-Areas with Description

Using WordPress version 2.9, there is now a possibility that we can write more detailed description for the widget areas. This is especially interesting when you define different widget areas, depending of categories or because the theme author defines various widget areas, that allows adjustments in more areas than just the sidebar. I do this for example in the theme Greyfoto, where the footer area is also equipped with widgets.

In the following example code we define a widget area, called My Lorem Ipsum Sidebar, which contains „detailed“ information.

if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
        'name' => 'My Lorem Ipsum Sidebar',
        'description' => __('Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.', 'your_textdomain'),
        'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); }

    wp-widgets

    A more comprehensive example with two widget areas, one area for the sidebar and an area for the footer.

    if ( function_exists('register_sidebar') ) {
        register_sidebar(array(
            'id' => 'sidebar',
            'name' => 'My Lorem Ipsum Sidebar',
            'description' => __('Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.', 'your_textdomain'),
            'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); register_sidebar(array( 'id' => 'footer', 'name' => 'My Lorem Ipsum Footer', 'description' => __('Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.', 'your_textdomain'), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); }

    This may be used as follows in the templates, it’s being used in the footer.php of the widget area My Lorem Ipsum Footer.

    
    

    Posted

    in

    by

    Comments

    4 responses to “WordPress Widget-Areas with Description”

    1. Markus Avatar

      danke für den tip
      Thanks for the tip

      Merry Christmas

    2. Matt Bridges Avatar

      Oh, beautiful. I have been having trouble figuring out exactly how to implement individual sidebars. Great tip!

    3. Mibaster Avatar

      Awesome, and easy! Thanks for sharing.

    4. kyle Avatar

      i had no idea i could add descriptions – lovely!
      ~k~