'widget_featured_slider widget_featured_meta', 'description' => __( 'Display latest posts or posts of specific category, which will be used as the slider.', 'colormag' ), ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Featured Category Slider', 'colormag' ), $widget_ops ); } function form( $instance ) { $tg_defaults['number'] = 4; $tg_defaults['type'] = 'latest'; $tg_defaults['category'] = ''; $instance = wp_parse_args( ( array ) $instance, $tg_defaults ); $number = $instance['number']; $type = $instance['type']; $category = $instance['category']; ?>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest" />
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category" />
' ', 'name' => $this->get_field_name( 'category' ), 'selected' => $category, ) ); ?>
$number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'post_status' => $post_status, ); // Display posts from category. if ( $type == 'category' ) { $args['category__in'] = $category; } $get_featured_posts = new WP_Query( $args ); echo $before_widget; ?>