WordPress Hack
Filed under: my.hacks
Tags: admin, hack, naming, panel, widgets, WordPress
WP, or WordPress, one of the most well known blogging softwares on the internet, which my blog really depends on
. It’s very easy to deal with, customize and implement new features as much as you want – If you didn’t find them implemented yet – . One of the most booming features of wordpress, that was really implemented to facilitate the use of the system is Widgets , it’s a simple way to manage the sidebar through the admin panel by just Draggin’ & Dropin’ widgets from this sidebar to another.
A problem that I was facing in a project I was working on, is that the customer needed the widgets to show it name instead of its number, so it shows Text (Info), instead of Text 1
I searched for a solution for that, but I found nothing on wordpress’ support forums, although I found some unanswered issues regarding this, I started digging in the system, when I found that the widget naming is one of the functions found in wp-includes/widgets.php .
At this file, exactly on line 605, it says:
$name = sprintf(__('Text %d'), $i);
so I changed this to :
$title = $options[$i]['title'];
$name = __('Text (' . $title . ')');
Added a title “info” to Text 1 widget, and with a simple refresh, I got this:
I think this might ease things up to those who deal with enormous number of widgets in their sidebar.
This is only valid in WordPress 2.3, and I dunnu if it will work in the next versions of the system.










Heh, good job buddy =)
hmmmm,
Howa ana msh 3aref eeh elle 7asal belzabt !!
bas it looks gr8 !
@Kama: Thanks pal
@Psycho: I once asked you about widgets and if you did use them before, lama kona fi nady el tagdef, u answered that you didn’t do so, the theme you are using now is widget enabled, try it and you will know what I’m talking about
Yeah great system for blogging but I still with Joomla’s side it has the best CMS in the world award oh yeah there is a contest in google code for joomla project and drupal if you are intrested to participate…
I forgot to tell you that google sent me a T-shirt for participating in google 2007 summer of code it was a great surprise for me that google send me something even zarf fady
without writing a line of code …
Good job…
I admit that Joomla is a marvelous CMS, but an enormous one!
About GSOC, it’s the first time to hear about that, I’m gonna check it and tell you what I have reached
, may be I’m gonna participate in the Drupal contest I think, but it says:
Is it limited for those only?!
LOL@ ZARF FADY
, gamda btw
, mabrok el T-Shirt
Thanks for passing by
Hey, I’m trying to have some custom text widgets that go with the theme I’m creating. Could you tell me the lines within widgets.php that create the text widgets and give it the user configure option. It seams I’ve been unable to find all the correct sections. Thanks!
it’s where it says
function wp_widget_text_register()Thanks, I got all the code and created a double of the text widget, but the original text widgets saves over the new one, even though I edited the name and anything else I could fine. They must have the same Database location or something. How do I change where the Widget is being saved?
What happens is I use Text 1 and have it say “ABC”. Then I use New 1 and have it say “XYZ”, but both Text 1 and New 1 say “ABC” after I save.
That can’t be, because that was tried before, can you please provide me with your wordpress version?!
I’m using 2.3.2. It has be possible, because it’s like creating an entirely new widget… but I don’t know where I’m going wrong.
can I have a look at that?!