-
Author
-
April 12, 2017 at 23:56 #158365joyParticipant
Hello, I have added a couple functions to display additional fields in the profile header. I am using the following code in my functions.php file. This displays the users location and the social icons.
‘
// Add Location to profile
add_action( ‘bp_profile_header_meta’, ‘display_user_location’ );
function display_user_location() {
$args = array(
‘field’ => ‘Location’, // Field name or ID.
);
$location = bp_get_profile_field_data( $args );
if ($location) {
echo ‘Location ‘ . $location;
}
}
/* adding social media icons to profile */
add_action(‘bp_profile_header_meta’,’social_links_in_header’);
function social_links_in_header () {
$social_links = array(‘facebook’,’twitter’,’google+’,’instagram’,’linkedin’,’youtube’,’pinterest’, ‘link’);
foreach( $social_links as $link ) {
if ( $data = bp_get_profile_field_data( array(‘user_id’=>bp_displayed_user_id(), ‘field’=>$link )) ) : ?>
<?php
if ($link == ‘google+’) {
$iconlink = ‘gplus’;
} elseif ($link == ‘pinterest’) {
$iconlink = ‘pinterest-circled’;
} elseif ($link == ‘instagram’) {
$iconlink = ‘instagramm’;
} else {
$iconlink = $link;
}
?>
<a href=”<?php echo bp_get_profile_field_data( array(‘user_id’=>bp_displayed_user_id(), ‘field’=>$link)); ?>” target=”_blank”><i class=”icon-<?php echo $iconlink; ?>”></i></a>
<?php endif;
}
}
‘
How do I add a line break between the two values? It currently shows on the same line and I can’t figure it out. Thank you.
April 13, 2017 at 17:07 #158435LauraModeratorHello, try by adding <br> or </br> before the <a href of the second code, let me know if that works 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
April 14, 2017 at 00:31 #158481joyParticipantI already tried that. If I place it within the a href=”…, it has no effect. If I place it before <br><a href=”…, all of the icons are displayed in a vertical line.
April 14, 2017 at 04:50 #158504LauraModeratorHello, please share access so i can check it out, it could be fixed with css.
Always happy to help 🙂Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
April 17, 2017 at 20:33 #158686LauraModeratorGlad you could resolve it! 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.