'mag-lite-home-tab', 'description' => esc_html__( 'Add Widget to Display Tab Section .', 'mag-lite' ) ); parent::__construct( 'mag_lite_home_tab',esc_html__( 'ML: Home Tab Section', 'mag-lite' ), $widget_ops, $control_ops ); } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'category' => '', 'number' => 2, 'category_news' => '', 'number_news' => 2, 'show_post_meta' => true, ) ); $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; $category = isset( $instance['category'] ) ? absint( $instance['category'] ) : 0; $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 2; $category_news = isset( $instance['category_news'] ) ? absint( $instance['category_news'] ) : 0; $number_news = isset( $instance['number_news'] ) ? absint( $instance['number_news'] ) : 2; $show_post_meta = isset( $instance['show_post_meta'] ) ? (bool) $instance['show_post_meta'] : true; ?>

'', 'class' => 'widefat', 'show_option_all' => esc_html__('Choose Options','mag-lite'), 'name' => esc_attr($this->get_field_name( 'category' )), 'selected' => absint( $category ), ) ); ?>

'', 'class' => 'widefat', 'show_option_all' => esc_html__('Choose Options','mag-lite'), 'name' => esc_attr($this->get_field_name( 'category_news' )), 'selected' => absint( $category_news ), ) ); ?>

id="get_field_id( 'show_post_meta' )); ?>" name="get_field_name( 'show_post_meta' )); ?>" />

2){ $total_number = 2; } $category_title = get_cat_name($category); $category_news_title = get_cat_name($category_news); if( !empty( $category ) || !empty( $category_news ) ): echo $before_widget; ?>
absint( $total_number ), 'post_type' => 'post', 'post_status' => 'publish', ); if ( absint( $category ) > 0 || absint( $category_news ) > 0 ) { $all_args['cat'] = array( absint( $category ), absint( $category_news ) ); } $all_query = new WP_Query( $all_args ); if ($all_query->have_posts()) : $cn = 0; while ( $all_query->have_posts() ) : $all_query->the_post(); $cn++;?>

absint( $number ), 'post_type' => 'post', 'post_status' => 'publish', ); if ( absint( $category ) > 0 ) { $category_args['cat'] = absint( $category ); } $the_query = new WP_Query( $category_args ); if ($the_query->have_posts()) : $cn = 0; while ( $the_query->have_posts() ) : $the_query->the_post(); $cn++;?>

absint( $number_news ), 'post_type' => 'post', 'post_status' => 'publish', ); if ( absint( $category_news ) > 0 ) { $category_args['cat'] = absint( $category_news ); } $the_query = new WP_Query( $category_args ); if ($the_query->have_posts()) : $cn = 0; while ( $the_query->have_posts() ) : $the_query->the_post(); $cn++;?>