'widget adore-widget featured-widget', 'description' => __( 'Retrive Posts List Widgets', 'blogic' ), ); parent::__construct( 'blogic_featured_posts_widget', __( 'Blogic Featured Posts Widget', 'blogic' ), $featured_posts_widget ); } /** * 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 ) { if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $featured_posts_title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; $featured_posts_title = apply_filters( 'widget_title', $featured_posts_title, $instance, $this->id_base ); $featured_posts_post_offset = isset( $instance['offset'] ) ? absint( $instance['offset'] ) : ''; $featured_posts_category = isset( $instance['category'] ) ? absint( $instance['category'] ) : ''; echo $args['before_widget']; ?>
'post', 'posts_per_page' => absint( 4 ), 'offset' => absint( $featured_posts_post_offset ), 'orderby' => 'date', 'order' => 'desc', 'cat' => absint( $featured_posts_category ), ); $query = new WP_Query( $featured_posts_widgets_args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>