'widget_envince_color widget_featured_posts widget_twocol_posts', 'description' => __( 'Display latest posts or posts of specific category in two column layout.', 'envince') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false,$name= __( 'TG: Two Column Featured Post Widget', 'envince' ),$widget_ops); } function form( $instance ) { $envince_defaults['title'] = ''; $envince_defaults['text'] = ''; $envince_defaults['number'] = 4; $envince_defaults['type'] = 'latest'; $envince_defaults['category'] = ''; $envince_defaults['child_category'] = '0'; $instance = wp_parse_args( (array) $instance, $envince_defaults ); $title = esc_attr( $instance[ 'title' ] ); $text = esc_textarea($instance['text']); $number = $instance['number']; $type = $instance['type']; $category = $instance['category']; $child_category = $instance[ 'child_category' ] ? 'checked="checked"' : ''; ?>

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 ) ); ?>

id="get_field_id( 'child_category' ); ?>" name="get_field_name( 'child_category' ); ?>" type="checkbox" />

$number, 'post_type' => 'post', 'ignore_sticky_posts' => true ) ); } else { if ( $child_category == 'true' ) { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'cat' => $category, 'no_found_rows' => true ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category, 'no_found_rows' => true ) ); } } echo $before_widget; ?> '. esc_html( $title ) .''; } if( !empty( $text ) ) { ?>

have_posts() ):$get_featured_posts->the_post(); ?> '; } elseif ( $i == 2 ) { echo '
'; } ?>
ID ); $image_id = get_post_thumbnail_id( get_the_ID() ); $image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true ); $image_alt_text = ! empty( $image_alt ) ? $image_alt : $title_attribute; $image .= '
'; $image .= ''; $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $image_alt_text ) ) ).''; $image .= '
'; echo $image; } ?>

'; } ?> 2 ) { echo '
'; } // Reset Post Data wp_reset_query(); ?>