'widget_featured_posts widget_featured_meta', 'description' => __( 'Display latest posts or posts of specific category.', 'colormag' ), 'customize_selective_refresh' => true, ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Featured Posts (Style 1)', 'colormag' ), $widget_ops ); } function form( $instance ) { $tg_defaults['title'] = ''; $tg_defaults['text'] = ''; $tg_defaults['number'] = 4; $tg_defaults['type'] = 'latest'; $tg_defaults['category'] = ''; $instance = wp_parse_args( ( array ) $instance, $tg_defaults ); $title = esc_attr( $instance['title'] ); $text = esc_textarea( $instance['text'] ); $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 from category chosen. if ( $type == 'category' ) { $args['category__in'] = $category; } $get_featured_posts = new WP_Query( $args ); echo $before_widget; ?> ' . esc_html( $title ) . ''; } if ( ! empty( $text ) ) { ?>have_posts() ):$get_featured_posts->the_post(); ?> '; } elseif ( $i == 2 ) { echo '