'latest_post', 'description' => esc_html__( 'Displays posts. Place it in "Footer Widget Area" and only works properly in this widget area.', 'newspaper-magazine' ), ); parent::__construct( 'newspaper-magazine-post-widget', esc_html__( 'Footer: Post Widget', 'newspaper-magazine' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', ! empty( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base ); $cat = ! empty( $instance[ 'cat' ] ) ? $instance[ 'cat' ] : absint( 0 ); $post_no = ! empty( $instance[ 'post_no' ] ) ? $instance[ 'post_no' ] : absint( 4 ); echo $args[ 'before_widget' ]; echo $args[ 'before_title' ]; echo $title; echo $args[ 'after_title' ]; $arguments = array( 'cat' => $cat, 'posts_per_page' => $post_no ); $query = new WP_Query( $arguments ); if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
'img-fluid' ) ); endif; ?>

'name', 'hide_empty' => 0, 'id' => $this->get_field_id( 'cat' ), 'name' => $this->get_field_name( 'cat' ), 'class' => 'widefat', 'taxonomy' => 'category', 'selected' => absint( $cat ), 'show_option_all' => esc_html__( 'All Categories', 'newspaper-magazine' ) ); wp_dropdown_categories( $cat_args ); ?>