Look at the Title Tag for Category New York:
[Edit/URL]
Look at the Title Tag for Tag Long Island:
[Edit/URL]
@mikey3D – there is something wrong in your set up. The default installation/theme shows the title tag with spaces between the words.
Are you using the default theme unmodified? Have you got any additional plugins running?
Switch to default theme, disable all plugins and let us know if the title tags now have spaces
“There is something wrong in your set up. The default installation/theme shows the title tag with spaces between the words.”
I have install WordPress and BuddyPress as clean as pure water. Trust me, it is the BuddyPress problem.
“Are you using the default theme unmodified?”
Default theme
“Have you got any additional plugins running?”
No! Only BuddyPress and I have added bp-custom.php from the last time we talked. I disable bp-custom.php.
https://buddypress.org/community/groups/requests-feedback/forum/topic/no-title-of-each-posts-and-pages/
The problem is still the same.
Thanks, Mikey3D
I’m talking about Title Tag, not h3 tag.
Not h3: You are browsing the archive for New York.
Title Tag: My blog | Blog | Categories | New-york
@rogercoathup,
Please add category “New York” and tag “Long Island” for “Hello world!” in your post.
http://playground.21inspired.com/
Thanks, Mikey3D
@mikey3D
Yes, sorry – I only checked a multi-word post title.
You are correct, categories and tag page titles are behaving differently in default BuddyPress vs. default WordPress install
The function that builds the title in BuddyPress is bp_page_title(). In WordPress it’s wp_title()
The WP function is doing a lot more work with the category and tag slug, taking the name slug it’s been passed (with the hyphens inserted) and looking up the correct (non-hyphenated) title to insert.
OK, two things I suggest:
1. Report this, and suggest that the bp_page_title() function should behave the same as wp_title() for categories, tags, etc. This would be the sensible way for the function to behave IMO. @hnla – is adding this to the trac, the correct way to raise this a possible fix?
2. For a quick fix, code your own title function, and replace the call to bp_page_title() in your header.php with a call to your own function
The function may look a little daunting, but should be reasonably straightforward with a bit of judicious copying and pasting from the existing BP and WP functions.
Cheers, Roger
There is already a Trac ticket on the issue of adding topic titles to bp_page_title() and in general the function is earmarked to be looked into in more depth I will add a link back to this thread so the issue is logged.
For now I guess you will need to patch as best you can or live with it until 1.3 is released.
Thanks, @rogercoathup & @hnla.
Can I have a patch?
Thanks, Mikey3D
@mikey3d did you follow point 2 that Roger explained above? there is no ‘Patch’ as such only what we( the community) can run up given the spare time. tbh this is something I would have not been too concerned with and awaited a core patch in a future release (I have suggested a core patch to address the problem, but that will probably be applied in 1.3 – too late to get in to 1.2.6)
If you want you can try this quick fix I’ve run up by exacting the relevant section from the core function and applying it as a filter in functions.php – it’s not widely tested and slightly hackish but appears to work:
`function bp_page_title_blog_category_remove_hyphens( $title ) {
global $bp, $wp_query;
if ( defined( ‘BP_ENABLE_MULTIBLOG’ ) ) {
$blog_title = get_blog_option( $current_blog->blog_id, ‘blogname’ );
} else {
$blog_title = get_blog_option( BP_ROOT_BLOG, ‘blogname’ );
}
if ( bp_is_blog_page() && is_category() )
$title = __( $blog_title . ‘| Blog | Categories | ‘ . ucwords( $wp_query->query_vars ), ‘buddypress’ );
$title = str_replace(‘-‘, ‘ ‘, $title);
return $title;
}
add_filter( ‘bp_page_title’, ‘bp_page_title_blog_category_remove_hyphens’ );
`
Let us know if that works for you?
It almost did works but…
There are two conflict codes for my title (/plugins/bp-custom.php) and your remove hyphens (/themes/my theme/function.php). The problem is your codes it only remove hyphen and it does not remove the first lowercase letter of second word. Ex:
The words New York:
1.) My title of category is “Category » New-york | My blog”
2.) Your remove hyphen title of category is “My blog| Blog | Categories | New york”
Can these codes put together in bp-custom.php if it could have two words with space, capital letter and my ways of doing the titles?
Thanks for your help, Mikey3D
here’s a quick adaptation then to give you all words uppercase, as for the order things are written in if you look at the first instance of $title you will see how the various parts are constructed, it’s a string so follows the order you read in, have a play around to get the order of things the way you want. if you want specific characters then you need to look up ‘html character entity codes’ to get things like ‘ » ‘
`function bp_page_title_blog_category_remove_hyphens( $title ) {
global $bp, $wp_query;
if ( defined( ‘BP_ENABLE_MULTIBLOG’ ) ) {
$blog_title = get_blog_option( $current_blog->blog_id, ‘blogname’ );
} else {
$blog_title = get_blog_option( BP_ROOT_BLOG, ‘blogname’ );
}
if ( bp_is_blog_page() && is_category() )
$title = __( $blog_title . ‘| Blog | Categories | ‘ . $wp_query->query_vars , ‘buddypress’ );
$title = str_replace(‘-‘, ‘ ‘, $title);
$title = ucwords($title);
return $title;
}
add_filter( ‘bp_page_title’, ‘bp_page_title_blog_category_remove_hyphens’ );`