Info
- 2 posts
- 2 voices
- Started 2 years ago by imgiseverything
- Latest reply from chrishajer
- This topic is not a support question
Forum title in bb_title on topic page
-
- Posted 2 years ago #
It was annoying me that by default bb_title() on the topic page didn't include the name of the forum in it. I wanted
Topic name < Forum name < Site name
but bb_title() default is:
Topic name < Site name
So I wrote this little plug-in and now I'm happier.
<?php
/*
Plugin Name: Better Topic Titles
Plugin URI:
Description: Add the forum (category) name to the topic title in <title> for the love of SEO!
Author: Phil Thompson
Version: 1.0
Author URI: http://imgiseverything.co.uk/
*/function better_topic_titles($title){
$separator = '«';
$forum_name = get_forum_name();
if(!empty($forum_name) && strpos($_SERVER['REQUEST_URI'], 'topic') !== false){
$title = str_replace($separator, $separator . ' ' . $forum_name . ' ' . $separator, $title);
}return $title;
}add_filter('bb_title', 'better_topic_titles');
?>
I've not found any issues with using it but I'm sure someone can have a look and improve it; if they think it's necessary.
-
- Posted 2 years ago #
I suggest you add this plugin to the bbPress plugin repository. Seems like it would be useful to some. Thank you.
-
You must log in to post.