5. Mai, 2006
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.
Verwandte Artikel:

7 Kommentare zu “WordPress Widgets Hack: Show Title on Widget”
Kommentar von MichaelH am 5. Mai, 2006 um 20:56
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/
Kommentar von MP:Schorsch am 5. Mai, 2006 um 22:40
thanks!
i looked at the trac but that is only for wordpress not the widgets.
Kommentar von Jeffrey am 30. Mai, 2006 um 21:18
$show_title= ‘( ‘.$widgettitle.’ )’;
Need to change ‘ to “
Kommentar von Jeffrey am 30. Mai, 2006 um 21:19
correction. that is the ones surrounding
Pingback von test > Hack widgets.php am 11. Juni, 2006 um 10:50
[...] 初期状態のwidgets.phpでは自分で設定したタイトルがウィジェットの各タブ?には表示されないので、ポップアップをクリックしないと確認できず、不便です。この問題をMP:Blog – Mediaprojekte – » WordPress Widgets Hack: Show Title on Widgetで解決してくれています。が、このままだと設定したタイトルとタブのタイトルが同じ場合でも表示されてしまい、見辛く(煩く)なってしまうので、変更しました。 [...]
Kommentar von Jeremy Douglass am 21. Juni, 2006 um 23:55
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.
Kommentar von MP:Schorsch am 22. Juni, 2006 um 0:55
Thanks for pointing this out!