Platinum SEO Pack is one of our favorite WordPress plugins, we install it on almost all of our sites. While working on improving RMD Motor’s title tags, we wanted to include parent category names in page titles, Platinum SEO Pack does not support this out of the box. I wrote a quick hack to include them.
To include parent category names in your page titles, open up platinum_seo_pack.php and scroll down to line 843 and look for this:
$category_name = ucwords($this->internationalize(single_cat_title('', false))); $title_format = get_option('aiosp_category_title_format'); $title = str_replace('%category_title%', $category_name, $title_format);
Replace that with the following:
$category_name_single = ucwords($this->internationalize(single_cat_title('', false)));
$cat = get_term_by('name', $category_name_single, 'category');
$parentCats = explode('^', get_category_parents($cat->term_id, FALSE, '^', FALSE));
for ($c=0;$c<count($parentCats);$c++) {
$category_name .= $parentCats[$c] . ' ';
}
$title_format = get_option('aiosp_category_title_format');
$title = str_replace('%category_title%', trim($category_name), $title_format);
Now, rather than “RS250” we have “Honda RS250T“, much better!
Thanks, i was looking for this solution.
Strange thing that Platinum seo programmers didn’t programmed this as a feature…