Advertisement
vapvarun

Trimmed Bio on Member's single page

Feb 18th, 2021
1,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. // echo trimmed bio field at profile header
  2.  
  3. add_action( 'bp_profile_header_meta', 'display_user_color_pref' );
  4. function display_user_color_pref() {
  5.      $args = array(
  6.         'field'   => 'My Bio', // Field name or ID.
  7.         );
  8.     $my_bio_excerpt = wp_trim_words( bp_get_profile_field_data( $args ), 20 );
  9.     if ($my_bio_excerpt) {
  10.         echo '<div class="my_bio">';
  11.         echo 'My Bio: ' . $my_bio_excerpt;
  12.          echo '</div>';
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement