'three-col-section news-col-3', 'description' => esc_html__( 'Widget to display news in three columns layout.', 'pt-magazine' ), ); parent::__construct( 'pt-magazine-three-column-news', esc_html__( 'PT: Three Column News', 'pt-magazine' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $three_category = ! empty( $instance['three_category'] ) ? $instance['three_category'] : 0; $view_all_text = !empty( $instance['view_all_text'] ) ? $instance['view_all_text'] : ''; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 6; echo $args['before_widget']; ?>
0 ){ $cat_link = get_category_link( $three_category ); }else{ $cat_link = ''; } ?>
absint( $post_number ), 'no_found_rows' => true, 'post__not_in' => get_option( 'sticky_posts' ), 'ignore_sticky_posts' => true, ); if ( absint( $three_category ) > 0 ) { $three_args['cat'] = absint( $three_category ); } $three_posts = new WP_Query( $three_args ); if ( $three_posts->have_posts() ) : while ( $three_posts->have_posts() ) : $three_posts->the_post(); ?>

'', 'three_category' => '', 'view_all_text' => esc_html__( 'View All', 'pt-magazine' ), 'post_number' => 6, ) ); ?>

'name', 'hide_empty' => 0, 'class' => 'widefat', 'taxonomy' => 'category', 'name' => $this->get_field_name( 'three_category' ), 'id' => $this->get_field_id( 'three_category' ), 'selected' => absint( $instance['three_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, '6' => 6, '9' => 9, ); if ( ! empty( $choices ) ) { $output = "\n"; } echo $output; } } endif;