[wp-hackers] Sidebar ID Naming Problems

Charles K. Clarkson cclarkson at htcomp.net
Mon Nov 16 22:58:30 UTC 2009


Jeremy Clarke wrote:

 > I'd just like to add a request for a 'description' setting for sidebars.
 > Somewhere you could put a couple lines of text explaining what/where the
 > sidebar is for/showing, so that if lots of sidebars are defined you don't
 > have to put tons of info  in the title field. If this is available somehow
 > and I'm missing it please let me know :)

You can do part of this now. I didn't look into how to add it to the
Widget Admin page, but there is no check by register_sidebar() to stop
you from adding additional fields now.

I tested with these:

$sidebar_id = register_sidebar(array(
     'name'         => '468x60 Post Banner',
     'before_title' => '<h4>',
     'after_title'  => '</h4>',
     'description'  => 'Add your banner markup to this sidebar. ' .
                       'It shows up on single post pages.',
));

function get_sidebar_description ($id) {
     global $wp_registered_sidebars;
     if ( array_key_exists($id, $wp_registered_sidebars) )
         return $wp_registered_sidebars[$id]['description'];

     return '';
}

echo get_sidebar_description($sidebar_id);


HTH,

Charles Clarkson
--
Mobile Home Investor
Free Market Advocate
Programmer

I'm not really a smart person. I just play one on the Internet.

Stephenville, TX
http://www.clarksonenergyhomes.com/wordpress/about/
http://twitter.com/CharlesClarkson
+1 (254) 968-8328



More information about the wp-hackers mailing list