__('Displays information about a Forumax forum topic', 'forumax'), ) // Widget description ); } // Creating widget front-end public function widget($args, $instance) { wp_enqueue_style('bbpc-forum'); global $post; if (!$post || !isset($post->ID) || $post->post_type != 'topic') { return; } $topic_id = $post->ID; $topic = get_post($topic_id); if (empty($topic) || $topic->post_type != 'topic') { return; } $forum_id = get_post_meta($topic_id, '_bbp_forum_id', true); $forum_url = get_permalink($forum_id); $forum_title = get_the_title($forum_id); $status = bbp_get_topic_status($topic_id); $replies = bbp_get_topic_reply_count($topic_id); $voices = bbp_get_topic_voice_count($topic_id); echo wp_kses_post($args['before_widget']); if (!empty($instance['title'])) { echo wp_kses_post($args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']); } echo ''; echo wp_kses_post($args['after_widget']); } // Widget Backend public function form($instance) { $title = $instance['title'] ?? ''; $topic_id = $instance['topic_id'] ?? ''; // Widget admin form ?>