'unique-post-section', 'description' => esc_html__( 'Displays latest posts or posts from a choosen category.', 'blog-personal' ), ); parent::__construct( 'Blog_Personal_Promo_Slider',esc_html__( 'Blog: Promo Slider', 'blog-personal' ), $widget_ops, $control_ops ); } function form( $instance ) { $defaults[ 'show_post_meta' ] = true; $defaults[ 'category' ] = ''; $defaults[ 'number' ] = 4; $instance = wp_parse_args( (array) $instance, $defaults ); $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 4; $category = isset( $instance['category'] ) ? absint( $instance['category'] ) : 0; $show_post_meta = isset( $instance['show_post_meta'] ) ? (bool) $instance['show_post_meta'] : true; ?>
id="get_field_id( 'show_post_meta' )); ?>" name="get_field_name( 'show_post_meta' )); ?>" />
'name', 'hide_empty' => 0, 'class' => 'widefat', 'show_option_none' => '', 'show_option_all' => esc_html__('— Select —','blog-personal'), 'name' => esc_attr($this->get_field_name( 'category' )), 'selected' => absint( $category ), ) ); ?>
absint( $number ), 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => get_option( 'sticky_posts' ), ); if ( absint( $category ) > 0 ) { $slider_args['cat'] = absint( $category ); } $the_query = new WP_Query( $slider_args ); if ($the_query->have_posts()) : ?>