How To Edit Title Tags?
-
Hi!
I was just wondering how to edit the title tags? Example: Buddypress Blogs – Home to
Buddypress Blogs | Tagline ?
Ive tried this code:
<?php wp_title(”); ?><?php if(wp_title(”, false)) { echo ‘ | ‘; } ?><?php bloginfo(‘name’); if(is_home()) { echo ‘ | ‘; bloginfo(‘description’); } ?>
It worked in none buddypress pages but on pages like Members, blogs, and forums it doesnt seem to work well as the title becomes something like Test Post | Buddypress Blogs, on all buddypress directories.
I hope someone could help? Thanks
-
anyone????
Try SEO for BuddyPress:
https://wordpress.org/extend/plugins/seo-for-buddypress/
Make sure you remove your <title> tag in your BuddyPress theme otherwise you’ll have double <title> tags.
Not sure about the plugin’s compatibility with BP 1.1-RC1.
—
Also just some friendly words of wisdom… try not to bump your post less than 24 hours after you have posted.
Sorry my bad . That plugin doesn’t work anymore, though.
Anyways I finally managed to make it work and customize the Title tags to make it a bit SEO friendlier.
To anyone else who wants pretty Title Tags, all you have to do is put something like this to your bp-custom.php
<?php
function my_page_title($title){
if ( is_home() && bp_is_page( ‘home’ ) ){
echo bloginfo(‘name’); echo ‘ | ‘; echo bloginfo(‘description’); }
elseif ( is_single() || is_category() || is_page(‘172’)) {
echo wp_title(‘ | ‘, false, right); echo bloginfo(‘name’); }
else {return ($title);}
}
add_filter(‘bp_page_title’, ‘my_page_title’, 10, 2);
?>
The Pages where you want the custom title tag to appear need to be specified or the title tags of the directories will get messed up.
But honestly I didnt care as much about the title tags of the directories.
This is inspired by the code from Burt Adsit on another thread I found. It’s all over the place but it works so if anyone has a better rendition, then do tell me please
- The topic ‘How To Edit Title Tags?’ is closed to new replies.