Last active
March 7, 2021 05:04
-
-
Save KaineLabs/49209b8e180cbf1ba2db171d2de23551 to your computer and use it in GitHub Desktop.
Add Members Directory Multiple Custom meta Fields
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
<?php | |
/** | |
* Add Members directory Custom meta. | |
*/ | |
function yzc_add_members_directory_custom_meta_fields() { | |
// Add Field Names or Ids. | |
$fields = array( 'name', 'age' ); | |
foreach ( $fields as $field ) { | |
$value = xprofile_get_field_data( $field, bp_get_member_user_id() ); | |
if ( empty( $value ) ) { | |
continue; | |
} | |
echo '<div class="youzify-name">' . $value . '</div>'; | |
} | |
} | |
add_action( 'bp_directory_members_item_meta', 'yzc_add_members_directory_custom_meta_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment