'forumax_recent_replies_widget widget_display_replies', 'description' => esc_html__('A list of the most recent replies.', 'forumax'), 'customize_selective_refresh' => true )); parent::__construct('forumax_recent_replies', esc_html__('(Forumax) Recent Replies', 'forumax'), $widget_ops); } /** * Register the widget */ public static function register_widget() { register_widget(__CLASS__); } /** * Displays the output, the replies list * * @param array $args Arguments * @param array $instance Instance */ public function widget($args = array(), $instance = array()) { wp_enqueue_style('bbpc-forum'); // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // Forumax filter $settings['title'] = apply_filters('forumax_replies_widget_title', $settings['title'], $instance, $this->id_base); // Note: private and hidden forums will be excluded via the // bbp_pre_get_posts_normalize_forum_visibility action and function. $widget_query = new WP_Query(array( 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_reply_statuses(), 'posts_per_page' => (int) $settings['max_shown'], 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false )); // Bail if no replies are found if (!$widget_query->have_posts()) { return; } echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } ?> parse_settings($instance); ?>

esc_html__('Recent Replies', 'forumax'), 'max_shown' => 5, 'show_date' => true, 'show_user' => true ), 'forumax_replies_widget_settings'); } }