'mix-news-section', 'description' => esc_html__( 'Widget to display news in mix columns layout. First post in full column and other in two column', 'pt-magazine' ), ); parent::__construct( 'pt-magazine-mix-column-news', esc_html__( 'PT: Mix Column News', 'pt-magazine' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $mix_category = ! empty( $instance['mix_category'] ) ? $instance['mix_category'] : 0; $view_all_text = !empty( $instance['view_all_text'] ) ? $instance['view_all_text'] : ''; $excerpt_length = !empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 20; $excerpt_length_small = !empty( $instance['excerpt_length_small'] ) ? $instance['excerpt_length_small'] : 12; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 5; echo $args['before_widget']; ?>
0 ){ $cat_link = get_category_link( $mix_category ); }else{ $cat_link = ''; } ?>
absint( $post_number ), 'no_found_rows' => true, 'post__not_in' => get_option( 'sticky_posts' ), 'ignore_sticky_posts' => true, ); if ( absint( $mix_category ) > 0 ) { $mix_args['cat'] = absint( $mix_category ); } $mix_posts = new WP_Query( $mix_args ); if ( $mix_posts->have_posts() ) : $mix_col_count = 1; while ( $mix_posts->have_posts() ) : $mix_posts->the_post(); if( 1 === $mix_col_count ){ ?>

'', 'mix_category' => '', 'view_all_text' => esc_html__( 'View All', 'pt-magazine' ), 'excerpt_length' => 20, 'excerpt_length_small' => 12, 'post_number' => 3, ) ); ?>

'name', 'hide_empty' => 0, 'class' => 'widefat', 'taxonomy' => 'category', 'name' => $this->get_field_name( 'mix_category' ), 'id' => $this->get_field_id( 'mix_category' ), 'selected' => absint( $instance['mix_category'] ), 'show_option_all' => esc_html__( 'All Categories','pt-magazine' ), ); wp_dropdown_categories( $cat_args ); ?>

dropdown_post_number( array( 'id' => $this->get_field_id( 'post_number' ), 'name' => $this->get_field_name( 'post_number' ), 'selected' => absint( $instance['post_number'] ), ) ); ?>

'', 'name' => '', 'selected' => 0, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = array( '3' => 3, '5' => 5, '7' => 7, ); if ( ! empty( $choices ) ) { $output = "\n"; } echo $output; } } endif;