'blacklite_latest_news_widget', 'description' => esc_html__('A widget that displays your latest posts from all categories or a certain', 'blacklite')); parent::__construct('blacklite_latest_news_widget', esc_html__('ZThemes: Latest Posts', 'blacklite'), $widget_ops); } function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title'] ); $categories = $instance['categories']; $number = $instance['number']; $query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'cat' => $categories); $loop = new WP_Query($query); if ($loop->have_posts()) : /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ( $title ) echo $before_title . $title . $after_title; ?>