monkeyscode/widget

create a backbon for widget in wordpress

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.1.10 2018-01-11 03:26 UTC

README

Create a backbone for widget in wordpress

Installation

Via composer

composer require monkeyscode/widget

Usage

Create a class that extends the core class

use MSC\Widget;

class TestWidget extends Widget
{
	public function __construct()
	{
		$widget = [
			'id' => 'test-widget',
			'label' => __('Test Widget'),
			'description' => __('This is test widget')
		];

		$fields = [
			[
		        'label' => 'Message',
		        'name' => 'message',
		        'type' => 'textarea',
			]
		];

		parent::__construct($widget, $fields);
	}
	
    public function handle($instance)
    {
        var_dump($instance);
	}

}

new TestWidget;

Available Fields

See List of fields to find out how to use these.

Contributor

Duy Nguyen

Changelogs

Changelogs