esc_html__( 'Displays posts in a two column layout.', 'pridmag' ), ) // Args ); } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { $defaults = array( 'title1' => esc_html__( 'Latest Posts', 'pridmag' ), 'category1' => '', 'number_posts1' => 4, 'viewall_text1' => esc_html__( 'View All', 'pridmag' ), 'title2' => esc_html__( 'Latest Posts', 'pridmag' ), 'category2' => '', 'number_posts2' => 4, 'viewall_text2' => esc_html__( 'View All', 'pridmag' ) ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

$this->get_field_name('category1'), 'selected' => $instance['category1'], 'show_option_all' => esc_html__( 'Show latest posts', 'pridmag' ), 'class' => 'widefat' ) ); ?>


$this->get_field_name('category2'), 'selected' => $instance['category2'], 'show_option_all' => esc_html__( 'Show latest posts', 'pridmag' ), 'class' => 'widefat' ) ); ?>

id_base ); $number_posts1 = ( ! empty( $instance['number_posts1'] ) ) ? absint( $instance['number_posts1'] ) : 4; $category1 = ( isset( $instance['category1'] ) ) ? absint( $instance['category1'] ) : ''; $viewall_text1 = ( ! empty( $instance['viewall_text1'] ) ) ? $instance['viewall_text1'] : ''; $title2 = ( ! empty( $instance['title2'] ) ) ? $instance['title2'] : ''; $title2 = apply_filters( 'widget_title', $title2 , $instance, $this->id_base ); $number_posts2 = ( ! empty( $instance['number_posts2'] ) ) ? absint( $instance['number_posts2'] ) : 4; $category2 = ( isset( $instance['category2'] ) ) ? absint( $instance['category2'] ) : ''; $viewall_text2 = ( ! empty( $instance['viewall_text2'] ) ) ? $instance['viewall_text2'] : ''; // Latest Posts 1 $latest_posts1 = new WP_Query( array( 'cat' => $category1, 'posts_per_page' => $number_posts1, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, ) ); // Latest Posts 2 $latest_posts2 = new WP_Query( array( 'cat' => $category2, 'posts_per_page' => $number_posts2, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, ) ); echo $before_widget; ?>
have_posts() ) : while ( $latest_posts1 -> have_posts() ) : $latest_posts1 -> the_post(); ?>
', '' ); ?>
have_posts() ) : while ( $latest_posts2 -> have_posts() ) : $latest_posts2 -> the_post(); ?>
', '' ); ?>