'two-col-section news-col-2', 'description' => esc_html__( 'Widget to display news in two columns.', 'pt-magazine' ), ); parent::__construct( 'pt-magazine-two-column-news', esc_html__( 'PT: Two Column News', 'pt-magazine' ), $opts ); } function widget( $args, $instance ) { $first_title = !empty( $instance['first_title'] ) ? $instance['first_title'] : ''; $first_category = ! empty( $instance['first_category'] ) ? $instance['first_category'] : 0; $second_title = !empty( $instance['second_title'] ) ? $instance['second_title'] : ''; $second_category = ! empty( $instance['second_category'] ) ? $instance['second_category'] : 0; $view_all_text = !empty( $instance['view_all_text'] ) ? $instance['view_all_text'] : ''; $excerpt_length = !empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 12; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 3; echo $args['before_widget']; ?>
0 ){ $cat_link = get_category_link( $first_category ); }else{ $cat_link = ''; } ?>
absint( $post_number ), 'no_found_rows' => true, 'post__not_in' => get_option( 'sticky_posts' ), 'ignore_sticky_posts' => true, ); if ( absint( $first_category ) > 0 ) { $first_col_args['cat'] = absint( $first_category ); } $first_col_posts = new WP_Query( $first_col_args ); if ( $first_col_posts->have_posts() ) : $first_col_count = 1; while ( $first_col_posts->have_posts() ) : $first_col_posts->the_post(); if( 1 === $first_col_count ){ ?>

0 ){ $cat_link_second = get_category_link( $second_category ); }else{ $cat_link_second = ''; } ?>
absint( $post_number ), 'no_found_rows' => true, 'post__not_in' => get_option( 'sticky_posts' ), 'ignore_sticky_posts' => true, ); if ( absint( $second_category ) > 0 ) { $second_col_args['cat'] = absint( $second_category ); } $second_col_posts = new WP_Query( $second_col_args ); if ( $second_col_posts->have_posts() ) : $second_col_count = 1; while ( $second_col_posts->have_posts() ) : $second_col_posts->the_post(); if( 1 === $second_col_count ){ ?>

'', 'first_category' => '', 'second_title' => '', 'second_category' => '', 'view_all_text' => esc_html__( 'View All', 'pt-magazine' ), 'excerpt_length' => 12, 'post_number' => 3, ) ); ?>

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

'name', 'hide_empty' => 0, 'class' => 'widefat', 'taxonomy' => 'category', 'name' => $this->get_field_name( 'second_category' ), 'id' => $this->get_field_id( 'second_category' ), 'selected' => absint( $instance['second_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;