'widget adore-widget list-widget style-1', 'description' => __( 'Retrive List Posts Widgets', 'archive-news' ), ); parent::__construct( 'archive_news_list_posts_widget', __( 'Adore Widget: List Posts Widget', 'archive-news' ), $list_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; } $list_posts_title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; $list_posts_title = apply_filters( 'widget_title', $list_posts_title, $instance, $this->id_base ); $viewall_button_label = ( ! empty( $instance['view_all_button_label'] ) ) ? $instance['view_all_button_label'] : ''; $list_posts_post_offset = isset( $instance['offset'] ) ? absint( $instance['offset'] ) : ''; $list_posts_category = isset( $instance['category'] ) ? absint( $instance['category'] ) : ''; $viewall_button_link = ( ! empty( $instance['view_all_button_link'] ) ) ? $instance['view_all_button_link'] : esc_url( get_category_link( $list_posts_category ) ); echo $args['before_widget']; if ( !empty( $list_posts_title || $viewall_button_label ) ) { ?>
'post', 'posts_per_page' => absint( 4 ), 'offset' => absint( $list_posts_post_offset ), 'cat' => absint( $list_posts_category ), ); $query = new WP_Query( $list_posts_widgets_args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $image_class = has_post_thumbnail() ? 'has-post-image' : ''; ?>

/i', '', $content ); // Remove image tags with alt attributes $content = wp_kses_post( wp_trim_words( $content, 30 ) ); ?>