'introduction_widget', 'description' => esc_html__( 'Compatible Area: Homepage, Sidebar, Footer', 'chives' ), ); parent::__construct( 'chives_introduction_widget', esc_html__( 'ST: Introduction Widget', 'chives' ), $st_widget_introduction ); } /** * 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 ); $read_more = isset( $instance['read_more'] ) ? $instance['read_more'] : esc_html__( 'Read More', 'chives' ); $page_id = isset( $instance['page_id'] ) ? $instance['page_id'] : ''; $query_args = array( 'post_type' => 'page', 'page_id' => absint( $page_id ), 'posts_per_page' => 1, ); $query = new WP_Query( $query_args ); echo $args['before_widget']; ?>
have_posts() ) : while ( $query -> have_posts() ) : $query -> the_post(); ?>