How to install WordPress Widgets
Widgets are one of the powerful feature of WordPress. As per WordPress Codex,
WordPress Widgets add content and features to your sidebars. Examples are the default widgets that come with WordPress; for post categories, tag clouds, navigation, search, etc. Plugins will often add their own widgets.
Widgets were originally designed to provide a simple and easy-to-use way of giving design and structure control of the WordPress Theme to the user, which is now available on properly “widgetized” WordPress Themes to include the header, footer, and elsewhere in the WordPress design and structure.
Widgets require no code experience or expertise. They can be added, removed, and rearranged on the WordPress Administration Appearance > Widgets panel.
Setting up a Widget
To install a widget (which is not a part of the plugin), You can follow any of the following methods.
Method 1: Simplest
1. Download required widget file from the link provided on the widget’s page to your theme’s directory
2. Include your widget PHP file to your “functions.php”
Method 2: Robust
Using a Professional Theme or Already have “widgets.php“
Please check if you already have a “widgets.php” file in your theme. If your theme is developed by a professional, you will already be having “widgets.php” some where. If you already have skip to step 4.
1. Download your required widget file from repository to your theme’s widgets directory
2. Include your downloaded widget file to your “widgets.php” or “functions.php”
Custom Developed Theme or You cant find widgets.php
1. Create a directory “widgets” in your theme
2. Create file “widgets.php” in “widgets” directory.
3. Include “widgets.php” in your “functions.php”
4. Now, Download your required widget file from the link provided on the widget’s page to your widgets directory
5. Include your widget PHP file to your “widgets.php”
Method 3: Convert Widget to Plugin
1. Download required widget file from the link provided on the widget’s page to plugin’s directory
2. Add “Plugin Name: ” beside the widget name in downloaded file as shown below
<?php /** * WPDS Image Widget * Frequently, we need to... * * Author: WPDevSnippets.com * @package WordPress */
<?php /** * Plugin Name: WPDS Image Widget * Frequently, we need to... * * Author: WPDevSnippets.com * @package WordPress */
3. Go to your WordPress Admin’s Plugin section and activate your widget which is your plugin now.