I've got 3 profile groups/sections in my Buddypress General profile tab.
I'm trying to add a custom shortcode into the first group, just under the first group.
This is my code:
add_action( 'bp_after_profile_loop_content', 'profile_choices_display' );
function profile_choices_display() {
if ( 1 == bp_get_the_profile_group_id()) {
echo do_shortcode( '[user-profile-choices]' );
}
}
Without the bp_get_the_profile_group_id()
filter, the shortcode is repeated under each of the 3 groups on that page.
Any ideas how to achieve this so it only shows after the first group?
CodePudding user response:
The hook you used is called too late. Try:
add_action( 'bp_after_profile_field_content', 'profile_choices_display' );
function profile_choices_display() {
if ( 1 == bp_get_the_profile_group_id()) {
echo do_shortcode( '[user-profile-choices]' );
}
}