Skip to content

Instantly share code, notes, and snippets.

View tmtrademark's full-sized avatar

Toby tmtrademark

  • Seattle
View GitHub Profile
@tmtrademark
tmtrademark / WidgetWithBehaviorScript.widget.php
Created August 25, 2011 23:15 — forked from westonruter/WidgetWithBehaviorScript.widget.php
Updtaed for 3.3, thanks xavisys || WidgetWithBehaviorScript: Template for a WordPress widget which enqueues an accompanying behavior script; script only output if widget is rendered.
<?php
class WidgetWithBehaviorScript extends WP_Widget {
function __construct() {
parent::__construct(__CLASS__, 'Widget with Accompanying Behavior Script', array(
'classname' => __CLASS__,
'description' => "This WordPress widget serves as a pattern for how to enqueue a script only if the widget is actually rendered."
));