Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Basic instantiation of an "Image of the Month" WordPress Widget
// we can only use this Widget if the plugin is active
if( class_exists( 'WidgetImageField' ) )
add_action( 'widgets_init', create_function( '', "register_widget( 'ITI_Widget_Image_OTM' );" ) );
class ITI_Widget_Image_OTM extends WP_Widget
var $image_field = 'image'; // the image field ID
function __construct()
$widget_ops = array(
'classname' => 'image_otm',
'description' => __( 'Image of the Month' )
parent::__construct( 'image_otm', __( 'Image of the Month' ), $widget_ops );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment