Title: Echo Field through code.
Last modified: November 14, 2016

---

# Echo Field through code.

 *  Resolved [noobiestrikesagain](https://wordpress.org/support/users/noobiestrikesagain/)
 * (@noobiestrikesagain)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/echo-field-through-code/)
 * Hey,
 * I would like to echo field if a specific condition is met.
    For example:
 *     ```
       if ( is_user_logged_in() && ! bp_is_my_profile()  ) {
       echo 'Field_id_01'
       } else {
       echo 'field_id_02}
       ```
   
 * Where field_id represents custom fields.
 * I know it sounds hard but is there any function to hide fields and then echo 
   them manually?
    Would greatly appreciate your help.
 * Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [noobiestrikesagain](https://wordpress.org/support/users/noobiestrikesagain/)
 * (@noobiestrikesagain)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8465940)
 * [@atallos](https://wordpress.org/support/users/atallos/),
 * Hey,
 * Available? I was thinking if I find any function to hide the field it would work.
 * As you mentioned on this [thread](https://wordpress.org/support/topic/need-a-field-which-cannot-be-modified-by-a-user/),`
   bxcft_edit_render_new_xprofile_field` will do the trick.
 * Any suggestions?
 * Please let me know what you think.
 *  [uplinkpunk](https://wordpress.org/support/users/uplinkpunk/)
 * (@uplinkpunk)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8565433)
 * [@atallos](https://wordpress.org/support/users/atallos/) +1 for the request.
 *  Thread Starter [noobiestrikesagain](https://wordpress.org/support/users/noobiestrikesagain/)
 * (@noobiestrikesagain)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8709530)
 * Hey [@atallos](https://wordpress.org/support/users/atallos/),
 * Please help me.
 *  Plugin Author [donmik](https://wordpress.org/support/users/atallos/)
 * (@atallos)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8714583)
 * I’m pretty sure I answered already this question in the support forums. You have
   to put your code inside the profile fields loop, check the field id you need 
   and show one or another using one of the buddypress functions to show profile
   field data:
 * [xprofile_get_field_data](http://hookr.io/functions/xprofile_get_field_data/)
 * or
 * [bp_get_profile_field_data](http://hookr.io/functions/bp_get_profile_field_data/)
 *  [uplinkpunk](https://wordpress.org/support/users/uplinkpunk/)
 * (@uplinkpunk)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8726157)
 * [@atallos](https://wordpress.org/support/users/atallos/),
 * Thanks!
 *  Thread Starter [noobiestrikesagain](https://wordpress.org/support/users/noobiestrikesagain/)
 * (@noobiestrikesagain)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8805619)
 * [@atallos](https://wordpress.org/support/users/atallos/),
 * I was able to do it by modifying edit.php
 * Thanks for the suggestion.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Echo Field through code.’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/buddypress-xprofile-custom-fields-
   type.svg)
 * [Buddypress Xprofile Custom Fields Type](https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/)
 * [Active Topics](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/reviews/)

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [xprofile](https://wordpress.org/support/topic-tag/xprofile/)

 * 6 replies
 * 3 participants
 * Last reply from: [noobiestrikesagain](https://wordpress.org/support/users/noobiestrikesagain/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/echo-field-through-code/#post-8805619)
 * Status: resolved