'consultus_Post_Widget', // CSS class name 'description' => esc_html__( 'Pro- Post Widget.', 'consultus' ), ); // instantiate the widget parent::__construct( 'consultus_Post_Widget', esc_html__( 'Pro- Post Widget', 'consultus' ), $options ); } public function widget( $args, $instance ) { $category = ( ! empty( $instance['category'] ) ) ? strip_tags( $instance['category'] ) : 0; $colums = (!empty($instance['colums'])) ? strip_tags($instance['colums']) : "col-md-3 col-sm-3 col-lg-3 col-xs-12"; // get the widget configuration $title = ""; if(isset($instance['title'])) $title = $instance['title']; if ( $title ) { echo "

".wp_kses_post($title)."

"; } ?>
'post', 'ignore_sticky_posts' => 1 , 'cat' => $category , 'posts_per_page' => absint($max_items), 'numberposts' => absint($max_items) , 'orderby' => 'date', 'order' => 'DESC' ); $page_query = new WP_Query($args);?> have_posts() ) : $page_query->the_post(); ?>

'name', 'exclude' => '', 'include' => '', 'parent' => 0 ); $categories = get_categories( $args ); $category_code = ''; if(0==$category){ $category_code = $category_code.''; } else{ $category_code = $category_code.''; } foreach ( $categories as $cat ) { $selected =''; if(($cat->term_id)==$category){ $selected ='Selected=selected'; } $category_code = $category_code.''; } // $bootstrap_colums = array( "col-md-12 col-sm-12 col-lg-12 col-xs-12" => 1, "col-md-6 col-sm-6 col-lg-6 col-xs-12" => 2, "col-md-4 col-sm-4 col-lg-4 col-xs-12" => 3, "col-md-3 col-sm-3 col-lg-3 col-xs-12" => 4, "col-md-2 col-sm-2 col-lg-2 col-xs-12" => 6, ); ?>