Created
February 4, 2012 17:52
-
-
Save jchristopher/1739179 to your computer and use it in GitHub Desktop.
The widget() function for our Image of the Month Widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function widget( $args, $instance ) | |
| { | |
| extract($args); | |
| $headline = $instance['headline']; | |
| $image_id = $instance[$this->image_field]; | |
| $blurb = $instance['blurb']; | |
| $image = new WidgetImageField( $this, $image_id ); | |
| echo $before_widget; | |
| ?> | |
| <?php if( !empty( $headline ) ) : ?> | |
| <h5 class="branded"><?php echo $headline; ?></h5> | |
| <?php endif; ?> | |
| <?php if( !empty( $image_id ) ) : ?> | |
| <img src="<?php echo $image->get_image_src( 'thumbnail' ); ?>" width="<?php echo $image->get_image_width( 'thumbnail' ); ?>" height="<?php echo $image->get_image_height( 'thumbnail' ); ?>" /> | |
| <?php endif; ?> | |
| <?php if( !empty( $blurb ) ) : ?> | |
| <p><?php echo $blurb; ?></p> | |
| <?php endif; ?> | |
| <?php | |
| echo $after_widget; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment