Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Rename sitewide page headers so “Blog” doesn't appear

I tweaked this for my needs. It now takes the ugly slugs and replaces hyphens with spaces and capitalizes the words. It also throws in a few titles for custom pages and my custom taxonomy.

function bpdev_blog_title($complete_title,$title_old){
global $bp,$current_blog,$wp_query,$post;
if ( bp_is_blog_page() ) {//if this is blog page
if ( is_single() ) {
$title = __($post->post_title, 'buddypress' );
} else if ( is_category() ) {
$cat = ucwords( str_replace("-", " ", $wp_query->query_vars['category_name'] ) );
$title = __( 'Topics | ' . $cat, 'buddypress' );
} else if ( is_tag() ) {
$tag = ucwords( str_replace("-", " ", $wp_query->query_vars['tag'] ) );
$title = __( 'Tags | ' . $tag, 'buddypress' );
} else if ( is_tax() ) {
$tax = ucwords( str_replace("-", " ", $wp_query->query_vars['term'] ) );
$title = __( 'Issues | ' . $tax, 'buddypress' );
} else if ( is_home() ) {
$title = __( 'Archives' );
} else if ( is_page( 'issues' ) ) {
$title = __( 'Issues' );
} else if ( is_page( 'topics' ) ) {
$title = __( 'Topics' );
}

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(!empty($title)) return $blog_title . ' | ' . esc_attr( $title );
}
//so on blog home page, It will show Blog, reason we have excluded that page
return $complete_title;
}

Skip to toolbar