This is an old post, but the concept still applies:
https://bbpress.org/forums/topic/title-tags#post-9045
bb_title
is the function you need to override with a plugin, such as this one. To see what bb_title
and bb_get_title
do, take a look at bb-includes/template-functions.php
starting around line 305 (in version 0.9.0.2).
Do you know what I did wrong? When I try to activate the plugin I get:
Plugin could not be activated; it produced a Fatal Error.
I want to get rid of the site title that comes after the topic title on topic pages. That way I’ll only have the <title>Topic Title</title> in the browser. I need some expert coder help. :o) This is what I have that did not work:
<?php
/*
Plugin Name: Title Modifier
Author: Matt George
*/
add_filter(‘bb_title’, ‘titlemodify’);
function titlemodify( $title ) {
//your code that does something to $title;
case ‘topic-page’:
$title[] = get_topic_title();
return $title;
}
?>
I don’t think you can do a case
without a switch
first. Something like this:
<?php
/*
Plugin Name: Title Modifier
Author: Matt George
*/
add_filter('bb_title', 'titlemodify');
function titlemodify( $title ) {
//your code that does something to $title;
switch ( bb_get_location() ) {
case 'topic-page':
$title[] = get_topic_title();
break;
}
return $title;
}
?>
It gave me this error:
Fatal error: [] operator not supported for strings in /home/prayer81/public_html/my-plugins/titlemodifier.php on line 13
So I took out [] and it works like a charm. Sweetness! Big thanks! I guess this is like my first attempt at a plugin. ;o)
I think that is a case of mixing an array ($title[]
) with a string ($title
). Somewhere, $title is being used as a string, and this piece of code wants to use it as the array $title[].
Glad you got it working. Hack away.
Thanks for this plugin snippet. This is the beauty of this software… so elegant and easy to modify.