__( 'Displays posts in a full width layout', 'awaken' ), ) // Args ); } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { //print_r($instance); $defaults = array( 'title1' => __( 'Latest Posts', 'awaken' ), 'category1' => '', 'number_posts1' => 3, 'sticky_posts1' => true, 'offset1' => 0, 'title2' => __( 'Latest Posts', 'awaken' ), 'category2' => '', 'number_posts2' => 3, 'sticky_posts2' => true, 'offset2' => 0 ); $instance = wp_parse_args( (array) $instance, $defaults ); $number_posts1 = isset( $instance['number_posts1'] ) ? absint( $instance['number_posts1'] ) : 3; $offset1 = isset( $instance['offset1'] ) ? absint( $instance['offset1'] ) : 0; $number_posts2 = isset( $instance['number_posts2'] ) ? absint( $instance['number_posts2'] ) : 3; $offset2 = isset( $instance['offset2'] ) ? absint( $instance['offset2'] ) : 0; ?>

First Set of Posts

$this->get_field_name('category1'), 'selected' => $instance['category1'], 'show_option_all' => 'Show all posts' ) ); ?>

class="checkbox" id="get_field_id('sticky_posts1'); ?>" name="get_field_name('sticky_posts1'); ?>" />


Second Set of Posts

$this->get_field_name('category2'), 'selected' => $instance['category2'], 'show_option_all' => 'Show all posts' ) ); ?>

class="checkbox" id="get_field_id('sticky_posts2'); ?>" name="get_field_name('sticky_posts2'); ?>" />

$category1, 'posts_per_page' => $number_posts1, 'post_status' => 'publish', 'ignore_sticky_posts' => $sticky_posts1, 'offset' => $offset1 ) ); // Latest Posts 2 $latest_posts2 = new WP_Query( array( 'cat' => $category2, 'posts_per_page' => $number_posts2, 'post_status' => 'publish', 'ignore_sticky_posts' => $sticky_posts2, 'offset' => $offset2 ) ); echo $before_widget; ?>
have_posts() ) : while ( $latest_posts1 -> have_posts() ) : $latest_posts1 -> the_post(); ?>
get_the_title()) ); ?> <?php the_title(); ?> ', esc_url( get_permalink() ) ), '' ); ?>
have_posts() ) : while ( $latest_posts2 -> have_posts() ) : $latest_posts2 -> the_post(); ?>
get_the_title()) ); ?> <?php the_title(); ?> ', esc_url( get_permalink() ) ), '' ); ?>