i18n->_('Feedback widget'), array( "description" => $this->i18n->_("This widget shows most popular post per post type."), "classname" => "anyway-feedback-popular-widget" ) ); } /** * Retrieve * * @param array $args * @param array $instance */ public function widget($args, $instance){ $title = empty($instance['title']) ? $this->name :apply_filters('widget_title', $instance['title']); $post_type = empty($instance['post_type']) ? 'post' :esc_attr($instance['post_type']); $num_posts = empty($instance['num_posts']) ? 5 : max(1, intval($instance['num_posts'])); $posts = $this->feedbacks->search(array( 'post_type' => $post_type, 'post_status' => 'publish', 'allow_empty' => false, 'orderby' => 'positive', 'order' => 'DESC' ), 1, $num_posts); ?>