- Hi there, how do I add a div class around this code snippet for styling, I have tried different approaches, but I can’t make it work, can you help? - /** * Buddypress Show Xprofile Field Data in The Profile Header. */ function yzc_add_xprofile_field_data_in_profile_header( $name ) { $field_data = xprofile_get_field_data( 'Age', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo '<br/><strong>Alder:</strong> ' . $field_data; $field_data = xprofile_get_field_data( 'From', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo ' <br/> <strong>Fra:</strong> ' . $field_data; $field_data = xprofile_get_field_data( 'Job', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo '<br/><strong>Job:</strong> ' . $field_data; } } } } add_action( 'bp_before_member_header_meta', 'yzc_add_xprofile_field_data_in_profile_header' );- Regards 
 Carsten
- Hi Carsten, 
 Thank you for the question.
 Here is the code with awrapper div.- /** * Buddypress Show Xprofile Field Data in The Profile Header. */ function yzc_add_xprofile_field_data_in_profile_header( $name ) { $field_data = xprofile_get_field_data( 'Age', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo "<div class='profile-job-info'>"; echo '<br/><strong>Alder:</strong> ' . $field_data; $field_data = xprofile_get_field_data( 'From', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo ' <br/> <strong>Fra:</strong> ' . $field_data; $field_data = xprofile_get_field_data( 'Job', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo '<br/><strong>Job:</strong> ' . $field_data; } } echo '</div>'; } } add_action( 'bp_before_member_header_meta', 'yzc_add_xprofile_field_data_in_profile_header' );- Regards 
 Brajesh
- Hi Carsten, 
 I am sorry for the delayed reply.- By mistake, I had made the code to show the data only if the “Age” was set. Please use this instead - /** * Buddypress Show Xprofile Field Data in The Profile Header. */ function yzc_add_xprofile_field_data_in_profile_header( $name ) { $field_data = xprofile_get_field_data( 'Age', bp_displayed_user_id() ); echo "<div class='profile-job-info'>"; echo '<br/><strong>Alder:</strong> ' . $field_data; $field_data = xprofile_get_field_data( 'From', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo ' <br/> <strong>Fra:</strong> ' . $field_data; $field_data = xprofile_get_field_data( 'Job', bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { echo '<br/><strong>Job:</strong> ' . $field_data; } echo '</div>'; } } add_action( 'bp_before_member_header_meta', 'yzc_add_xprofile_field_data_in_profile_header' );- Regards 
 Brajesh
 Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
 This topic is: not resolved