Info
- 7 posts
- 3 voices
- Started 3 years ago by photolord
- Latest reply from sockmoney
- This topic is resolved
Modify Topic Title Tags
-
- Posted 3 years ago #
I looked on here, but wasn't quite able to find how to do this. If I missed it I apologize. How would I modify topic titles to not have the name of the forum in the title? What would I change? What file would I modify? Such as:
This is the default title structure right now on my theme:
<title>Topic Title >> Forum Name</title>I would like to change the title structure to this:
<title>Topic Title</title>Any ideas? Thanks.
Best regards,
Matt
-
- Posted 3 years ago #
This is an old post, but the concept still applies:
http://bbpress.org/forums/topic/title-tags#post-9045bb_titleis the function you need to override with a plugin, such as this one. To see whatbb_titleandbb_get_titledo, take a look atbb-includes/template-functions.phpstarting around line 305 (in version 0.9.0.2). -
- Posted 3 years ago #
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;
}
?> -
- Posted 3 years ago #
I don't think you can do a
casewithout aswitchfirst. 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; } ?> -
- Posted 3 years ago #
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)
-
- Posted 3 years ago #
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.
-
- Posted 2 years ago #
Thanks for this plugin snippet. This is the beauty of this software... so elegant and easy to modify.
-
You must log in to post.