Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Are wordpress widgets for the most part universal? WordPress

The title pretty much says it all.

As far as moving them from theme to theme, unless they are plugin specific?

I ask because I have a few themes and would like to integrate some widgets into one theme from the others.

Please try to explain in simplicity if you reply, as I am early in readying into the wordpress codex

Sorry, I am new to wordpress used to be all Vbulletin. :P

Answers (2)


Plugarized answers:

WordPress Widgets are like a plugin, but designed to provide a simple way to arrange your sidebar content without having to change any code. Widgets can include the search bar, recent comments, recent posts, tags, for example.

Most plugins have widgets available and you can place these on sidebars.

Here is a video explaining what a wordpress widget is

Plugarized comments:

Any widget available through plugins can be used on any WordPress installation, all you have to do is upload the plugin to the plugin's folder and then activate it through the plugin administration and if that plugin has a widget available you go to the widget panel and add it to a sidebar.

Some widgets are hardcoded into a theme and thats because it is using functions custom made for that theme only perhaps. with experience you can extract these and make your own plugin for your theme.


Dbranes answers:

Yes, the widgets are for the most part universal, i.e. they are theme independent in general
(but some themes come with their own widgets)

Here is a good starting point:

To use the widgets in your theme, you need to "widgetize" it, see fx.

but most of the new themes today are widget ready.

You can also build your custom widgets:

or install a plugin with a special widget you need.

Hope this helps.

nimo comments:

This is directed for both replys. Maybe I should have been clearer.

Your both saying for the most part I should be able to use most widgets on any theme?

If I were to run into problems what would be the likely cause of that?

Whats the process of transfering a widget from one theme to the next? (codex page link?)


Dbranes comments:

If a widget is defined within the theme, the code is most likely to be found in the file "functions.php" (in the current theme directory)

You could then search for code like:

register_widget("some widget name")

and WP_Widget class extensions:

class some_widget_name extends WP_Widget

Dbranes comments:

if you have access to linux command line, you can just use grep, fx like:

grep "register_widget" -R .

within the /wp-content/themes/ directory.

Dbranes comments:

here is an example of a widget defined within a theme:

theme TwentyEleven:

/twentyeleven/functions.php: register_widget( 'Twenty_Eleven_Ephemera_Widget' );
/twentyeleven/inc/widgets.php:class Twenty_Eleven_Ephemera_Widget extends WP_Widget {