Where do I save widget code for wordpress? Where do I save widget code for wordpress? wordpress wordpress

Where do I save widget code for wordpress?


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:

<?php/*Plugin Name: Name Of The PluginPlugin URI: http://URI_Of_Page_Describing_Plugin_and_UpdatesDescription: A brief description of the Plugin.Version: The Plugin's Version Number, e.g.: 1.0Author: Name Of The Plugin AuthorAuthor URI: http://URI_Of_The_Plugin_AuthorLicense: 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.

Sources:

http://codex.wordpress.org/Writing_a_Plugin

http://codex.wordpress.org/Plugin_API


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?


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