• hi, I have created a shortcode to display the xprofile data in a custom page.

    function bp_view( $atts ){
    
    global $bp;
    bp_get_template_part( 'members/single/profile/profile-loop' );
    
    }
    add_shortcode( 'bp_view', 'bp_view' );

    the above works, however, the shortcode is called prior to the content before it, so it is located in an undesirable place. so I found a topic that resolves the issue, and below is the implemented code:

    function bp_view( $atts ){
    
    global $bp;
    ob_start();
    $profile_output = bp_get_template_part( 'members/single/profile/profile-loop' );
    ob_end_clean();
    return $profile_output;
    
    }
    add_shortcode( 'bp_view', 'bp_view' );

    It is now in the right place but it only prints the url extention without calling the loop.

    is there a way to fix it? thanks.

  • The topic ‘buddypress: shortcode only returns url’ is closed to new replies.