Forum title in bb_title on topic page
-
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, ‘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.
- You must be logged in to reply to this topic.