WordPress is robust CMF(Content Management Framework) and CMS(Content Management System). We could extend its functionality by developing plugins and design custom themes according to our requirements.
So, WordPress is the fully customizable system ever developed.Because of that many blogging sites and Websites were developed in WordPress.
In this post I am going to write about “How to create a custom widget in WordPress?”
Step 1: Define Widget Support in function.php
The very first step is, we have to define widget support in functions.php before adding any functionality.
Check it out if your functions.php has not add_theme_support(‘widgets’); then add this code.
Step 2: Create Widget
We could create Widgets in functions.php , but i am going to separate this code by creating a widget folder in the includes folder. And mention in functions.php like this,
Step 3: Code for Custom Widget
Now, the final step is to create a custom widget, the actual code starts now.
After writing these codes in your file widget_theme.php , check is the widget created or not?
If all goes right then you will see widget created like this