View Full Version : What makes a WordPress widget... a widget?
ses5909
11-07-2007, 08:42 PM
I had previously thought that the widgets were all javascript but it seems that for WordPress, widgets can be PHP (just like a plugin). So please someone break it down for me... is the condition of a WordPress widget that it must be able to be dragged and dropped into the sidebar??
I suppose it is and I have several that aren't javascript or even php for that matter. Just good old fashioned html so I suppose like you say it is just something that you access through the widgets page :)
SarahG
11-07-2007, 09:52 PM
Yes, a WordPress widget can be PHP or anything. Designed originally for non techies. It means that you can drag and drop the various widgets onto your sidebar and easily reorder them without needing to write any code.
My first plugin was widgetised by a friend. Seems like you just add a few lines of extra PHP. I'm still wondering (haven't looked into it yet) as to whether you can create a plugin that can be used as a widget but also not as a widget.
BPartch
11-07-2007, 10:55 PM
Yes a widget is a plugin that has some additional code added to it. I do not know what I am talking about so here is more info: Widgetizing Automattic (http://automattic.com/code/widgets/plugins/)
Jeremy
11-07-2007, 11:28 PM
widgets are for n00bs
http://threadbombing.com/data/media/40/noob.gif
doorlight
11-08-2007, 07:08 AM
I use widgets, now I retired from coding. yey.
Why not give it a try, sarah? :naughty: Also, widgets save time.
Jeremy, I'm not a noob!! lol. I'm mad. :hanson:
doorlight
11-08-2007, 07:15 AM
My widgets:
http://i129.photobucket.com/albums/p233/laasya/widgetsss.jpg
:naughty:
Anyway, what are the possible disadvantages of using widgets?
SarahG
11-08-2007, 09:52 AM
lack of flexibility and control. Well, that is unless you can easily edit the widget file (which defeats the object of it being a draggable widget) or you have every feature as an editable option (which you should but not everyone thinks like that).
However I'm only guessing as I don't use them ;)
shyflower
11-08-2007, 04:30 PM
I think it's mostly the drag and drop that makes a widget a widget. Also that you don't have to worry about it overflowing your sidebar and screwing up the theme.
By the way... this area is a great new addition Sara! I am depending on all of you techies to teach an old lady some new tricks!
ses5909
11-08-2007, 06:58 PM
We're counting on you Linda to teach us some as well!
goldfries
11-08-2007, 09:42 PM
A Widget MUST appear on the list of Widgets in Wordpress. :)
I made a plugin the other day and someone suggested I made it easy to use for non-programming people.
So I took the challenge, Widgetized my plugin. :) So now it's usable on Widget-aware themes PLUS you get to customize it from the dashboard. :D
Of course, you don't have to be a widget to be able to customize from the dashboard. I just add the customization part on dashboard for convenience.
Michael Martin
11-08-2007, 10:45 PM
lack of flexibility and control. Well, that is unless you can easily edit the widget file (which defeats the object of it being a draggable widget) or you have every feature as an editable option (which you should but not everyone thinks like that).
However I'm only guessing as I don't use them ;)
Editing is the same as a regular WP plugin really. Tick a few boxes for what you can, and you can edit the plugin file for the rest. :)
SarahG
11-09-2007, 08:43 AM
but if widgets are more designed for non coders, then they won't be wanting to edit the plugin file.
On my first plugin I first had the bulk of the code in the plugin. Then I realised a few people were asking how to change the h3 to a h2, add a class into the list. So I dumped all of the code besides the list item output. However from my understanding, in a widgettised sidebar you can't add in HTML around a widget? So in theory I would need to offer the option to predetermine the code via an admin options page.
But again, I'm just guessing as I've never looked at them although I want to get my plugin working fully as a widget as well as standard so I will be when I have time!
doorlight
11-09-2007, 10:50 AM
However from my understanding, in a widgettised sidebar you can't add in HTML around a widget? So in theory I would need to offer the option to predetermine the code via an admin options page.
Yes. You can use htmls (using txt widget) and even PHP (using PHP code widget) in widgets. :) So, I guess, you still code.
uhm wait, are you referring to sidebar.php? haha. overlooked.
SarahG
11-09-2007, 01:37 PM
yeah I meant in the sidebar ;) I can't see a way that you can add in additional html into the dynamic sidebar.
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.