Easy Widgets plugin lets you easily create widgets in WordPress.
Author: | Talasan Nicholson (profile at wordpress.org) |
WordPress version required: | 3.0 |
WordPress version tested: | 3.4.2 |
Plugin version: | 1.1.1 |
Added to WordPress repository: | 09-09-2012 |
Last updated: | 17-09-2012
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 74 |
Rated by: | 3 |
Plugin URI: | http://wordpress.org/extend/plugins/easy-widg... |
Total downloads: | 1 475 |
Active installs: | 40+ |
Click to start download |
Easy Widgets plugin provides an API to easily add widgets in WordPress.
Example of Use
- Create a file "widgets.php" in your themes /inc/ folder
- In functions.php use locate_template to include your widgets.php file: locate_template(array('/inc/widgets.php'), true);
In widgets.php, do something like below:
/** * Custom widgets. */ $prefix = 'replaceMe_'; $widgets = array(); // ----------------------------------------------- /** * easyBox widget */ $widgets[] = array( 'id' => 'easyBox', 'title' => $prefix.'easyBox', 'desc' => 'Create a simple text widget', // All fields can be called by their // simple variables: title => $title 'fields' => array( array( 'name' => 'Title', 'id' => 'title', 'type' => 'text' ), array( 'name' => 'Body', 'id' => 'body', 'type' => 'textarea' ), array( 'name' => 'Category', 'id' => 'category', 'type' => 'select', 'options' => array( 'one', 'two', 'three' ) ) ), // This is what will appear in the sidebar as HTML 'output' => ' <article class="easyBox"> <h1><?=$title?></h1> <small><?=$category?></small> <p><?=$body?></p> </article> ' ); // ----------------------------------------------- /** * Iterate and register the widgets */ if (class_exists('WidgetCreator')) { foreach ($widgets AS &$w) { $WC = new WidgetCreator($w); eval($WC->render()); } } else trigger_error('WidgetCreator does not exist.', E_USER_ERROR);
Features
- Easily create custom widgets to use on your website.
- Lets you control the output of the widget.
- Flawlessly integrates itself into your themes.
Supported Field Types
- text
- textarea
- checkbox
- select
More to come soon, as it seems necessary. You may request new fields.