__( 'Displays information about a bbPress forum topic', 'bbp-core' ), ) // Widget description ); } // Creating widget front-end public function widget( $args, $instance ) { 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 $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; } echo ''; echo $args['after_widget']; } // Widget Backend public function form( $instance ) { $title = $instance['title'] ?? ''; $topic_id = $instance['topic_id'] ?? ''; // Widget admin form ?>