Created
May 27, 2013 13:46
-
-
Save danbp/5657144 to your computer and use it in GitHub Desktop.
BuddyPress 1.7.X
Add some social icons on a profile header, at the right of the avatar below the activity meta
Pictures are send by CSS with the <i> tag
Goes into theme's functions.php file.
Tested on BP 1.7.2 and bp-default theme.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add some social icons on a profile header | |
function bpfr_socialize_profile () { | |
echo '<br>'; | |
//check if the field contain a value. If it has one show it. | |
if ( $data = bp_get_profile_field_data( 'field=Twitter ' ) ) : | |
?> | |
<a href="http://twitter.com/<?php echo xprofile_get_field_data( 'Twitter', bp_displayed_user_id() );?>/" target="_blank" title="Twitter"><i class="icon-twitter"></i></a> | |
<?php endif; // end of the field value check | |
if ( $data = bp_get_profile_field_data( 'field=Facebook ' ) ) : | |
?> | |
<a href="http://facebook.com/<?php echo xprofile_get_field_data( 'Facebook', bp_displayed_user_id() );?>/" target="_blank" title="Facebook"><i class="icon-facebook"></i></a> | |
<?php | |
endif; | |
} | |
add_filter( 'bp_before_member_header_meta', 'bpfr_socialize_profile' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment