為 bbPress 論壇帖子添加 “樓主” 標識

類似其他的論壇,帖子的發布者會帶有 “樓主” 標識。

轉載自薇曉朵技術論壇

將下面的代碼片段添加到已激活主題的 functions.php 文件即可:

//添加樓主和非樓主角色
function bbp_post_starter( $args = '' ) {
	$topic_author = bbp_get_topic_author_id();
	$reply_author = bbp_get_reply_author_id( $reply_id );
	
	if ( bbp_is_single_user_replies() ) {
		
	}
	elseif ( $reply_author === $topic_author ) {
		?>
        <span class="post-starter-bq"> 樓主</span>
        <?php
	}
}
add_filter('bbp_theme_after_reply_author_details', 'bbp_post_starter');
文章沒看懂?代碼不會用?需要幫助您可以去論壇提問自助服務台

作者Geticer

WordPress的忠實用戶,喜歡講述與BuddyPress和bbPress等有關的故事。 同時也是一位Minecraft玩家……