__( 'Adds Blog section', 'krystal'), ) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { extract( $args ); extract( wp_parse_args( $instance, $this->defaults ) ); $nop = ! empty( $instance['nop'] ) ? $instance['nop'] : '2'; $options = array( 'post_type' => 'post', 'posts_per_page' => $nop, ); $query = new WP_Query( $options ); // run the loop based on the query if ( $query->have_posts() ) { ?>
have_posts() ) { $query->the_post(); $postid = get_the_ID(); ?>