# bbp-core/trunk/templates/content-single-topic-lead.php

Forumax – AI Powered Advanced Community Forum Plugin, version trunk. 215 lines.

- Page: https://pluginprobe.com/plugins/bbp-core/trunk/code/templates/content-single-topic-lead.php
- Raw: https://pluginprobe.com/plugins/bbp-core/trunk/raw/templates/content-single-topic-lead.php
- Modified: 2026-08-13T11:39:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/bbp-core/trunk/code/templates/content-single-topic-lead.php#L10-L20`.

```php
<?php

/**
 * Single Topic Lead Content Part
 *
 * @package bbPress
 * @subpackage Theme
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

do_action( 'bbp_template_before_lead_topic' );

$topic_tag_list    = bbp_get_topic_tag_list(
	get_the_ID(),
	array(
		'before' => '',
		'after'  => '',
		'sep'    => ', ',
		'none'   => '',
	)
);
$has_topic_tags    = ! empty( $topic_tag_list );
$action_btns_class = $has_topic_tags ? 'has-topic-tags' : 'no-topic-tags';
?>
<div class="main-post">
	<div class="topic-content-wrapper">

		<div class="forum-post-top">
			<div class="bbp-author-wrap">
				<div class="author-avatar bbp-author-link">
					<?php
					echo bbp_get_topic_author_link(
						array(
							'post_id' => get_the_ID(),
							'size'    => 40,
							'type'    => 'avatar',
						)
					);
					?>
				</div>

				<div class="forum-post-author">
					<div class="topic-author author-flex author-gap">
						<?php
						echo bbp_get_topic_author_link(
							array(
								'post_id' => get_the_ID(),
								'type'    => 'name',
							)
						);
						?>
						<div class="author-badge badge <?php echo esc_attr( sanitize_title( forumax_get_bbp_user_role() ) ); ?>">
							<?php forumax_bbp_user_role_icon(); ?>
							<span><?php echo esc_html( forumax_get_bbp_user_role() ); ?></span>
						</div>
					</div>

					<div class="forum-author-meta meta">
						<span title="<?php bbp_topic_post_date( get_the_ID() ); ?>">
							<?php bbp_topic_post_date( get_the_ID(), true ); ?>
						</span>
						<span class="dot"></span>
						<?php $lead_reply_count = bbp_get_topic_reply_count( bbp_get_topic_id() ); ?>
						<a href="#topic-<?php bbp_topic_id(); ?>-replies" class="replies-count">
							<?php
							printf(
								/* translators: %s: number of replies */
								esc_html( _n( '%s Reply', '%s Replies', $lead_reply_count, 'forumax' ) ),
								esc_html( number_format_i18n( $lead_reply_count ) )
							);
							?>
						</a>
					</div>
				</div>
			</div>

			<div class="action-button-container">
				<?php
				if ( is_user_logged_in() ) :
					bbp_topic_subscription_link(
						array(
							'before'      => '',
							'after'       => '',
							'unsubscribe' => esc_html__( 'Subscribed', 'forumax' ),
						)
					);
				else :
					if ( get_option( '_bbp_enable_subscriptions' ) == 1 && forumax_get_opt( 'is_topic_subscription' ) == 1 ) :
						?>
						<button class="button subscription-login-btn frmx-subscribe-trigger-btn">
							<?php esc_html_e( 'Log in to subscribe', 'forumax' ); ?>
						</button>
						<div class="subscription-login-modal frmx-topic-sub-modal">
							<div class="subscription-login-modal-inner">
								<button class="subscription-login-modal-close" aria-label="<?php esc_attr_e( 'Close', 'forumax' ); ?>">&times;</button>
								<h3 class="frmx-inline-login-title"><?php echo esc_html( forumax_get_opt( 'subscription_modal_title', __( 'Login to the community', 'forumax' ) ) ); ?></h3>
								<p class="frmx-inline-login-subtitle"><?php echo esc_html( forumax_get_opt( 'subscription_modal_subtitle', __( 'You must be logged in to subscribe to this topic.', 'forumax' ) ) ); ?></p>
								<div class="frmx-subscription-login-form">
									<button type="button" class="button fill-brand frmx-scroll-to-login">
										<?php esc_html_e( 'Go to login form', 'forumax' ); ?>
									</button>
								</div>
							</div>
						</div>
						<?php
					endif;
				endif;
				?>

				<?php
				/**
				 * Topic admin links dropdown (⋯ three-dot menu).
				 * Placed next to Subscribe for quick access.
				 */
				if ( is_user_logged_in() && function_exists( 'forumax_get_topic_admin_links' ) ) {
					echo forumax_get_topic_admin_links(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				}
				?>
			</div>
		</div>

		<div class="q-title">
		<?php
		$topic_prefix = forumax_get_opt( 'topic_title_prefix', 'Q:' );
		if ( ! empty( $topic_prefix ) ) :
		?>
			<span class="question-icon" title="Question">
				<?php echo esc_html( $topic_prefix ); ?>
			</span>
		<?php endif; ?>
			<h1>
				<?php do_action( 'bbp_theme_before_topic_title' ); ?>
				<?php
				the_title();
				do_action( 'bbpc-resolved-topics' );
				?>
			</h1>
		</div>

		<div class="forum-post-content">
			<?php do_action('bbp_theme_after_topic_author_details'); ?>
			<div class="topic-content-layout">
				<?php
				$topic_post = get_post();
				$forum_id   = $topic_post ? bbp_get_topic_forum_id( $topic_post->ID ) : 0;
				$forum_vote = $forum_id ? get_post_meta( $forum_id, 'bbp_voting_forum_enable_topics', true ) : '';

				// Note: despite the option id name, this switcher is used as an enable flag in the voting frontend.
				$topic_voting_enabled = ! empty( forumax_get_opt( 'is_voting_disabled_topics', 0 ) );
				$voting_feature_on    = (bool) forumax_get_opt( 'is_votes', true );

				$show_vote_column = $voting_feature_on
					&& (bool) has_action( 'bbp_voting_cpt' )
					&& ( ( ! empty( $forum_vote ) && $forum_vote !== 'false' ) || ( empty( $forum_vote ) && $topic_voting_enabled ) );
				?>
				<?php if ( $show_vote_column ) : ?>
					<div class="topic-vote-column">
						<?php
						/**
						 * Render only the voting UI in the left column.
						 */
						do_action( 'bbp_voting_cpt', $topic_post );
						?>
					</div>
				<?php endif; ?>

				<div class="topic-content-body">
					<div class="content editor-content">
						<?php do_action('bbp_theme_before_topic_content'); ?>
						<?php bbp_topic_content(); ?>
					</div>

					<div class="action-button-container action-btns <?php echo esc_attr( $action_btns_class ); ?>">
						<?php
						if ( has_action( 'bbp_theme_after_topic_content', 'bbp_voting_buttons' ) ) {
							remove_action( 'bbp_theme_after_topic_content', 'bbp_voting_buttons' );
						}
						?>
						<?php do_action('bbp_theme_after_topic_content'); ?>
						<?php if ( $has_topic_tags ) : ?>
							<div class="taxonomy forum-post-tags">
								<?php
								echo wp_kses_post(
									'<span class="tags-label">' . esc_html__( 'Tags:', 'forumax' ) . '</span> <span class="tags">' . $topic_tag_list . '</span>'
								);
								?>
							</div>
						<?php endif; ?>

						<div class="frmx-action-btns-right">
							<?php
							bbp_topic_favorite_link(
								array(
									'before' => '',
								)
							);
							?>
							<?php
							// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
							echo forumax_topic_social_share();
							?>
						</div>
					</div>
				</div>
			</div>
		</div>

	</div>
</div>

<?php
do_action( 'bbp_template_after_lead_topic' );

```
