WordPress Widgets Hack: Show Title on Widget
Having a lot of RSS/Text or King Widgets brings up a Problem in the Admin Interface.
You have to klick on each Widget to see whats in there.
The Solution is to show the title of each Widget (if it has one) next to the widget name in the drag drop view.
Code
I made a little change to the widget.php (the original widget plugin v.1.0).
Open widget.php and go to Line 607 -> in function widget_draggable($name)
Original Line 607
———–
echo "<li class=’module’ id=’widgetprefix-$san_name’><span class=’handle’>$name$popper</span></li>";
———–
Replace the Line 607 with this:
———–
// start widget title enhancements by georg leciejewski
if(!empty($registered_widgets[$name]['params'])){
$number = $registered_widgets[$name]['params'][0];
$options =get_option($registered_widgets[$name]['classname']);
$widgettitle=$options[$number]['title'] ;
}else{
$options =get_option($registered_widgets[$name]['classname']);
$widgettitle=$options['title'] ;
}
//show only if title is populated
if(!empty($widgettitle)){
$show_title= ‘<small>( ‘.$widgettitle.’ )</small>’;
}
// end widget title enhancements by georg leciejewski
echo "<li class=’module’ id=’widgetprefix-$san_name’><span class=’handle’>$name $show_title $popper</span></li>";
———–
Now the Widget Title guides you the way through your widget jungle.
WordPress Widgets Hack: Show Title on Widget
You can follow all the replies to this entry through the comments feed.


Thanks for pointing this out!
Thanks. For those using a more recent version of widgets.php, the new insertion point is at line 621. Also note that the code sample above contains “smart quotes” – you’ll need to correct them all to plain quotes.
correction. that is the ones surrounding
$show_title= ‘( ‘.$widgettitle.’ )’;
Need to change ‘ to “
thanks!
i looked at the trac but that is only for wordpress not the widgets.
Great Hack. I’ve been thinking of suggesting this to the WordPress programmers. Please consider putting your code in as a case at the WordPress ‘bug’ site, http://trac.wordpress.org/