'two_columns_blog_pattern_widget', 'description' => 'This widget enables the two_columns type blog pattern on the home page.', ); parent::__construct( 'two_columns_blog_pattern_widget', 'Two Columns Blog Pattern', $widget_ops ); } /** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // outputs the content of the widget echo $args['before_widget']; if ( !empty( $instance['title'] ) ) { echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; } $_max = $instance['numb_post']; $paged = (get_query_var( 'paged' )) ? get_query_var( 'paged' ) : 1; // WP_Query arguments ?>
array( 'post' ), 'post_status' => array( 'publish' ), 'paged' => $paged, 'cat' => $instance['left_category'], 'posts_per_page' => $_max, ); $query = new WP_Query( $blog_args ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); get_template_part( 'templates/home', 'content-two-columns-pattern' ); } } ?>
array( 'post' ), 'post_status' => array( 'publish' ), 'paged' => $paged, 'cat' => $instance['right_category'], 'posts_per_page' => $_max, ); $query = new WP_Query( $blog_args ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); get_template_part( 'templates/home', 'content-two-columns-pattern' ); } } ?>

$this->get_field_name( 'left_category' ), 'selected' => $left_category ) ); ?>

$this->get_field_name( 'right_category' ), 'selected' => $right_category ) ); ?>