Simple WordPress Widget Template

Widgets are utilized by tons of WordPress themes and plugins as a way to display customized content in various locations, and they’re relatively easy to create, as long as you have the appropriate resources. The code below will give you everything you need to make extensive and advanced widgets that can do anything you want.
I am not going to explain what everything does, but it is not difficult to figure out. You can copy the code below into your functions.php or plugin file; it will register a simple widget that accepts a “title” and “message” options.

To expand on this simple widget, just duplicate and rename the fields, then modify their field types as necessary.
I will explain this code in detail, and provide examples of more advanced widgets in upcoming posts.