Tagged: code, member type, titles
Hi!
I am using ‘BuddyPress Member Type Generator’ plugin to generate 3 types of members. ‘Students’, ‘Teachers’, ‘Guardians’. Now, I have 3 directories of members
mtsite-com/members/type/students/ (can these urls be customized / shorten?)
mtsite-com/members/type/teachers/
mtsite-com/members/type/guardians/Current meta title of all 3 directories same ‘Memebers – MySite’. I wish to insert the actual member type in title to make it for example :
‘Students – MySite’ OR ‘Students – Members – MySite’ (First is preferable)
Please help me with this
Thank you very much
Hi Lavish,
Thank you for using the BuddyPress Members Type plugin.
For member type directory title, since BuddyPress currently does not support it, you can put the following in your bp-custom.php to make it work
/** * Modify members directory title for the member types * * @param array $title title parts * * @return array */ function bpdev_modify_page_member_directory_title( $title ) { if ( ! bp_is_members_directory() ) { return $title; } $member_type = bp_get_current_member_type(); if ( ! $member_type ) { return $title; } $type_object = bp_get_member_type_object( $member_type ); $sep = apply_filters( 'document_title_separator', '-' ); $title['title'] = $title['title'] . ' ' . $sep . ' ' . $type_object->labels['singular_name']; return $title; } add_filter( 'document_title_parts', 'bpdev_modify_page_member_directory_title', 1000 );
Hope that helps.
Hi Lavish,
You can change$type_object->labels['singular_name']
to
$type_object->labels['name']
In the above code to do that.
Regards
BrajeshPerfect! 🙂
Can you tell me where can I change ‘Viewing members of the type’ to ‘Viewing profiles of the type’? I was looking for the phrase in po files for the translation but couldn’t locate it.
And can the url be changed from “/members/type/teachers/” to “/members/teachers/” or even better “/teachers/”?
Many thanks
Hi Lavish,
I am sorry but you can not do that. BuddyPress does not support that yet.A possible solution will be to create a custom page template with member loops. The url aesthetics may not be worth the time though.
The topic ‘ [Resolved] Insert 'Member Type' in the Title of Member Directories’ is closed to new replies.