Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Last active May 16, 2023 06:06
Show Gist options
  • Save raftaar1191/f4e4ea7e6443ad729b5fd658c823db03 to your computer and use it in GitHub Desktop.
Save raftaar1191/f4e4ea7e6443ad729b5fd658c823db03 to your computer and use it in GitHub Desktop.
BuddyPress Print shortcode
function BP_theme_child_profile_link( $atts ) {
$text = isset( $atts['text'] ) ? $atts['text'] : 'Profile Link';
$profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() );
$profile_link = trailingslashit( $profile_link . 'change-avatar' );
return sprintf( '<a href="%s">%s</a>', $profile_link, $text );
}
add_shortcode( 'BP_profile_link', 'BP_theme_child_profile_link' );
add_filter( 'bp_core_render_message_content', 'do_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment