Tagged: member page title
Hi Elio,
Welcome to BuddyDev.Please put this code in your bp-custom.php or in your theme’s functions.php and It will do
function buddydev_append_membertype_in_directory_title( $bp_title, $old_title ) { $member_type = bp_get_current_member_type(); if ( ! $member_type ) { return $bp_title; } $type_object = bp_get_member_type_object( $member_type ); $bp_title['title'] = $bp_title['title'] . ': ' . $type_object->labels['singular_name'] ; return $bp_title; } add_filter( 'bp_modify_document_title_parts', 'buddydev_append_membertype_in_directory_title', 10, 2 );
Hope that helps.
Regards
BrajeshHi Brajesh,
Thanks for the quick response.
I tried in both bp-custom.php and functions.php files, also with standard template and with all the plugin deactivated (except for BuddyPress Member Type Generator and Buddypress) but seems not change the member page title.. some workaround that I can do to find the problem?Thanks again
ElioHi Elio,
Thank you for the detailed reply.It is for the title in the browser(The
attribute). Are you referring to Directory title inside the page? Hi Elio,
Please add thisfunction buddydev_append_membertype_in_page_title( $title, $component ) { if ( $component != 'members' ) { return $title; } $member_type = bp_get_current_member_type(); if ( ! $member_type ) { return $title; } $type_object = bp_get_member_type_object( $member_type ); $title = $title . ': ' . $type_object->labels['singular_name'] ; return $title; } add_filter( 'bp_get_directory_title', 'buddydev_append_membertype_in_page_title' , 10, 2 );
and let me know if it works for you or not?
Thank you
BrajeshHi sorry to drag up an old thread but..
The code works great for my needs, is there anyway to remove the members : part and just leave the page title? e.g. my page title currently says Members : Artwork and I need it to just say Artwork. Also I’m trying this on the member type generator, I will be purchasing the pro, will it also work on that?
Thanks Jon- This reply was modified 6 years, 3 months ago by Jon.
Hi Jon,
Welcome to BuddyDev.You can change this line
$bp_title['title'] = $bp_title['title'] . ': ' . $type_object->labels['singular_name'] ;
to
$bp_title['title'] = $type_object->labels['singular_name'] ;
That will do it.
Thank you for considering the member type generator and pro. yes, It will work for both.
Regards
Brajesh
The topic ‘ [Resolved] Add the member type value (i.e. student, teacher ecc) in the member page title’ is closed to new replies.