我想做这样的事情:<title>Custom text...</title>
在bbPress主页上。我花了几个小时寻找答案,但我找不到它......
我知道可以创建页面并添加短代码,如下所示:https://codex.bbpress.org/features/shortcodes/但是在这种情况下,如果我的 bbPress 根 slug 与页面相同,则不起作用。如果 slug 不同 - 我将有两个主页:/
有人有类似的问题吗?
您可以使用
此钩子在bbPress主页顶部执行自定义代码。
'bbp_template_before_forums_index'
例:
add_action( 'bbp_template_before_forums_index', 'your_callback_function' );
function your_callback_function(){
$output_html = '';
$output_html .= "<title>Custom text...</title>";
echo $output_html;
}
在您的函数.php文件中使用此代码,希望对您有所帮助。