Are you looking for a way to customize the ‘Follow Me’ link text? While there’s probably a plugin for this, we have created a quick code snippet that you can use to change the follow me button text in BuddyPress.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
function custom_follow_button_args( $button_args, $leader_id, $follower_id ) { $button_args['link_text'] = 'FOLLOW ME....'; return $button_args; } add_filter( 'bp_follow_get_add_follow_button', 'custom_follow_button_args', 10, 3 );
$leader_id : The user ID of the person we want to follow. - bp_displayed_user_id(); $follower_id : The user ID initiating the follow request. - bp_loggedin_user_id(); $link_text : The anchor text for the link. $link_title : The title attribute for the link. $wrapper_class : CSS class for the wrapper container. $link_class : CSS class for the link. $wrapper : The element for the wrapper container. Defaults to 'div'.
You can also even embed a ‘follow me’ image instead of the text, by replacing the text Follow Me with an image, like this: $button_args['link_text'] = '<img src="path/to/image.png" />';
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 9 best WordPress auction plugins to build the next eBay and 7 best WordPress calendar plugins.
Comments Leave a Reply