Take the 2-minute tour ×

I've googled around quite a lot, but can't seem to find where I should be saving the code for the widget I've created. It's a bit baffling.

So, can anyone tell me where I should save my widget?

Thanks, John.

share|improve this question
You might have better luck at wordpress.stackexchange.com –  Brian Willis Apr 27 '11 at 2:03
add comment

3 Answers

up vote 2 down vote accepted

You need to put your widget code in either the functions.php file of your current theme, or within a plugin. In order to put it in a plugin, create a new folder in the plugins folder and create a .php file with the name of the folder you created within that folder. In that file, use this code to start your plugin:

Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2

Obviously, change the values to something useful for your plugin. You can then paste your widget code into this file and it should be ready to use.




share|improve this answer
add comment

As far as I know, widget (ie plugins) go in your wp-content/plugins folder eg. wp-content/plugins/YOUR WIDGET/

Is that what you need?

share|improve this answer
add comment

You can save your code in the file of wp-content\themes\YOUR-THEME-NAME\functions.php.

share|improve this answer
add comment

Your Answer


