I have just created my first WordPress widget ("hello world" style) and was able to display it correctly. But what I notice that if I change my theme then my created widget disappears from available widget area in admin panel; though there are many widgets which are always showed regardless of chosen theme (Like Text widget). I want to know how can I make my widget available across all the themes?

  • is your widget code part of a theme or in a plugin?
    – Milo
    Oct 14, 2013 at 17:02
  • @Milo Its actually in a theme. How can I create it as a plugin? Can you suggest any tutorial. Sorry I am newbie in wordpress coding.
    – ferdousx
    Oct 14, 2013 at 17:19

1 Answer 1


Put all your custom widget code into a separate php file, add a plugin header:

 * 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

then upload it to your plugins directory and activate it. That's it!

  • Thx. Will definitely try it.
    – ferdousx
    Oct 15, 2013 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.