'mag-lite-tab-collecion',
'description' => esc_html__( 'Add Widget to Display Tab Section .', 'mag-lite' )
);
parent::__construct( 'mag_lite_tab_collection',esc_html__( 'ML: Home Tab Collection', 'mag-lite' ), $widget_ops, $control_ops );
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array(
'category' => '',
'number' => 4,
'category_news' => '',
'number_news' => 4,
'category_style' => '',
'number_style' => 4,
) );
$category = isset( $instance['category'] ) ? absint( $instance['category'] ) : 0;
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 4;
$category_news = isset( $instance['category_news'] ) ? absint( $instance['category_news'] ) : 0;
$number_news = isset( $instance['number_news'] ) ? absint( $instance['number_news'] ) : 4;
$category_style = isset( $instance['category_style'] ) ? absint( $instance['category_style'] ) : 0;
$number_style = isset( $instance['number_style'] ) ? absint( $instance['number_style'] ) : 4;
?>
'',
'class' => 'widefat',
'show_option_all' => esc_html__('Choose Option','mag-lite'),
'name' => esc_attr($this->get_field_name( 'category' )),
'selected' => absint( $category ),
) );
?>
'',
'class' => 'widefat',
'show_option_all' => esc_html__('Choose Option','mag-lite'),
'name' => esc_attr($this->get_field_name( 'category_news' )),
'selected' => absint( $category_news ),
) );
?>
'',
'class' => 'widefat',
'show_option_all' => esc_html__('Choose Option','mag-lite'),
'name' => esc_attr($this->get_field_name( 'category_style' )),
'selected' => absint( $category_style ),
) );
?>
absint( $number ),
'post_type' => 'post',
'post_status' => 'publish',
);
if ( absint( $category ) > 0 || absint( $category_news ) > 0 || absint( $category_style ) > 0 ) {
$all_args['cat'] = array( absint( $category ), absint( $category_news ), absint( $category_style ) );
}
$the_query = new WP_Query( $all_args );
if ($the_query->have_posts()) : $cn = 1;
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
';
} elseif ( $cn == 4){
echo '
';
} ?>
5 ) {
$post_class = 'small-post';
$image_size= 'mag-lite-promo-latest-popular-thumbnail';
}
if( $cn >3 ) {
$post_width_class = 'custom-col-6';
}
$slider_post = 'slider-content';
$slider_text = 'slider-text';
if( $cn >3 ) {
$slider_post = 'post';
$slider_text = 'post-content';
}
?>
';
}
$cn++; ?>
';
} elseif ( $cn <= 10 ){
echo '
';
}
wp_reset_postdata();?>
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 = 1;
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
';
} elseif ( $cn == 4){
echo '
';
} ?>
5 ) {
$post_class = 'small-post';
$image_size= 'mag-lite-promo-latest-popular-thumbnail';
}
if( $cn >3 ) {
$post_width_class = 'custom-col-6';
}
$slider_post = 'slider-content';
$slider_text = 'slider-text';
if( $cn >3 ) {
$slider_post = 'post';
$slider_text = 'post-content';
}
?>
';
}
$cn++; ?>
'; }
if ( $cn <=10 ) { echo '
'; }
wp_reset_postdata();?>
absint( $number_news ),
'post_type' => 'post',
'post_status' => 'publish',
);
if ( absint( $category_news ) > 0 ) {
$category_arg['cat'] = absint( $category_news );
}
$the_query = new WP_Query( $category_arg );
if ($the_query->have_posts()) : $cn = 1;
while ( $the_query->have_posts() ) : $the_query->the_post(); //var_dump( $cn);?>
2 ) {
$post_class = 'small-post';
$image_size= 'mag-lite-promo-latest-popular-thumbnail';
}
$no_image= '';
if( !has_post_thumbnail() ){
$no_image = 'no-image';
}
?>
absint( $number_style ),
'post_type' => 'post',
'post_status' => 'publish',
);
if ( absint( $category_style ) > 0 ) {
$category_style_args['cat'] = absint( $category_style );
}
$the_query = new WP_Query( $category_style_args );
if ($the_query->have_posts()) : $cn = 1;
while ( $the_query->have_posts() ) : $the_query->the_post();
$no_image= '';
if( !has_post_thumbnail() ){
$no_image = 'no-image';
}
?>