Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The form() for our Image of the Month Widget
<?php
function form( $instance )
{
$headline = esc_attr( isset( $instance['headline'] ) ? $instance['headline'] : '' );
$image_id = esc_attr( isset( $instance[$this->image_field] ) ? $instance[$this->image_field] : 0 );
$blurb = esc_attr( isset( $instance['blurb'] ) ? $instance['blurb'] : '' );
$image = new WidgetImageField( $this, $image_id );
?>
<p>
<label for="<?php echo $this->get_field_id( 'headline' ); ?>"><?php _e( 'Headline:' ); ?>
<input class="widefat" id="<?php echo $this->get_field_id( 'headline' ); ?>" name="<?php echo $this->get_field_name( 'headline' ); ?>" type="text" value="<?php echo $headline; ?>" />
</label>
</p>
<div>
<label><?php _e( 'Image:' ); ?></label>
<?php echo $image->get_widget_field(); ?>
</div>
<p>
<label for="<?php echo $this->get_field_id( 'blurb' ); ?>"><?php _e( 'Blurb:' ); ?>
<input class="widefat" id="<?php echo $this->get_field_id( 'blurb' ); ?>" name="<?php echo $this->get_field_name( 'blurb' ); ?>" type="text" value="<?php echo $blurb; ?>" />
</label>
</p>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment