SHARE
TWEET

Untitled

a guest Jul 12th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Add Profile Header Custom Fields.
  4.  */
  5. function yzc_add_profile_header_custom_meta_fields() {
  6.    
  7.     // Add Field Names or Ids.
  8.     $fields = array(
  9.         array(
  10.             'field_id_or_name' => 'age',
  11.             'icon' => 'fas fa-birthday-cake',
  12.         ),
  13.         array(
  14.             'field_id_or_name' => 'last name',
  15.             'icon' => 'fas fa-mask',
  16.         )
  17.     );
  18.  
  19.     foreach ( $fields as $field  ) {
  20.        
  21.         $value = xprofile_get_field_data( $field['field_id_or_name'], bp_displayed_user_id() );
  22.        
  23.         if ( empty( $value ) ) {
  24.             continue;
  25.         }
  26.  
  27.         echo '<li><i class="' . $field['icon'] . '" aria-hidden="true"></i><span>' . $value . '</span></li>';
  28.  
  29.     }
  30.  
  31. }
  32. add_action( 'yz_get_profile_header_user_meta', 'yzc_add_profile_header_custom_meta_fields' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top