defaults = array(
'title' => '',
'posts_cat' => '',
'posts_num' => 1,
'posts_offset' => 0,
'orderby' => '',
'order' => '',
'exclude_displayed' => 0,
'show_image' => 0,
'image_alignment' => '',
'image_size' => '',
'show_gravatar' => 0,
'gravatar_alignment' => '',
'gravatar_size' => '',
'show_title' => 0,
'show_byline' => 0,
'post_info' => '[post_date] ' . __( 'By', 'omega' ) . ' [post_author_posts_link] [post_comments]',
'show_content' => 'excerpt',
'content_limit' => '',
'more_text' => __( '[Read More...]', 'omega' ),
'extra_num' => '',
'extra_title' => '',
'more_from_category' => '',
'more_from_category_text' => __( 'More Posts from this Category', 'omega' ),
);
$widget_ops = array(
'classname' => 'featured-content featuredpost',
'description' => __( 'Displays featured posts with thumbnails', 'omega' ),
);
$control_ops = array(
'id_base' => 'featured-post',
'width' => 505,
'height' => 350,
);
parent::__construct( 'featured-post', __( 'Featured Posts', 'omega' ), $widget_ops, $control_ops );
}
/**
* Echo the widget content.
*
* @since 0.9.1
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
function widget( $args, $instance ) {
global $wp_query, $_omega_displayed_ids;
//$_omega_displayed_ids[] = get_the_ID();
extract( $args );
//* Merge with defaults
$instance = wp_parse_args( (array) $instance, $this->defaults );
echo $before_widget;
//* Set up the author bio
if ( ! empty( $instance['title'] ) )
echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
$query_args = array(
'post_type' => 'post',
'cat' => $instance['posts_cat'],
'showposts' => $instance['posts_num'],
'offset' => $instance['posts_offset'],
'orderby' => $instance['orderby'],
'order' => $instance['order'],
);
//* Exclude displayed IDs from this loop?
if ( $instance['exclude_displayed'] )
$query_args['post__not_in'] = (array) $_omega_displayed_ids;
$wp_query = new WP_Query( $query_args );
if ( have_posts() ) : while ( have_posts() ) : the_post();
$_omega_displayed_ids[] = get_the_ID();
echo '%s
', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() );
}
if ( ! empty( $instance['show_byline'] ) && ! empty( $instance['post_info'] ) )
printf( '', do_shortcode( $instance['post_info'] ) );
if ( $instance['show_title'] )
echo '