defaults = array( 'title' => '', 'page_id' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => '', ); $widget_ops = array( 'classname' => 'featured-content featuredpage', 'description' => __( 'Displays featured page with thumbnails', 'omega' ), ); $control_ops = array( 'id_base' => 'featured-page', 'width' => 200, 'height' => 250, ); parent::__construct( 'featured-page', __( 'Featured Page', '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; 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; $wp_query = new WP_Query( array( 'page_id' => $instance['page_id'] ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); echo '
'; $image = omega_get_image( array( 'format' => 'html', 'size' => $instance['image_size'] ) ); if ( $instance['show_image'] && $image ) printf( '%s', get_permalink(), the_title_attribute( 'echo=0' ), esc_attr( $instance['image_alignment'] ), $image ); if ( ! empty( $instance['show_title'] ) ) { printf( '

%s

', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() ); } if ( ! empty( $instance['show_content'] ) ) { echo '
'; if ( empty( $instance['content_limit'] ) ) { global $more; $more = 0; the_content( $instance['more_text'] ); } else { the_content_limit( (int) $instance['content_limit'], esc_html( $instance['more_text'] ) ); } echo '
'; } echo '
'; endwhile; endif; //* Restore original query wp_reset_query(); echo $after_widget; } /** * Update a particular instance. * * This function should check that $new_instance is set correctly. * The newly calculated value of $instance should be returned. * If "false" is returned, the instance won't be saved/updated. * * @since 0.9.1 * * @param array $new_instance New settings for this instance as input by the user via form() * @param array $old_instance Old settings for this instance * @return array Settings to save or bool false to cancel saving */ function update( $new_instance, $old_instance ) { $new_instance['title'] = strip_tags( $new_instance['title'] ); $new_instance['more_text'] = strip_tags( $new_instance['more_text'] ); return $new_instance; } /** * Echo the settings update form. * * @since 0.9.1 * * @param array $instance Current settings */ function form( $instance ) { //* Merge with defaults $instance = wp_parse_args( (array) $instance, $this->defaults ); ?>

$this->get_field_name( 'page_id' ), 'selected' => $instance['page_id'] ) ); ?>


/>


/>

/>