'featured_widget', 'description' => esc_html__( 'Compatible Area: Homepage, Sidebar, Footer', 'chives' ), ); parent::__construct( 'chives_featured_widget', esc_html__( 'ST: Featured Widget', 'chives' ), $st_widget_featured ); } /** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // outputs the content of the widget if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $title = ( ! empty( $instance['title'] ) ) ? ( $instance['title'] ) : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $page_ids = array(); for ( $i = 1; $i <= 3; $i++ ) : if ( ! empty( $instance['page_id_' . $i] ) ) : $page_ids[] = $instance['page_id_' . $i]; endif; endfor; $query_args = array( 'post_type' => 'page', 'post__in' => ( array ) $page_ids, 'posts_per_page' => 3, 'orderby' => 'post__in', ); $query = new WP_Query( $query_args ); echo $args['before_widget']; ?>