Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to display a custom field?

@stilld

Participant

Hi mcUK!

Thanks for you reply. I’m working with Lotte on this issue.

I tried adding your code. Everything should be in place right now, but it’s still not showing the custom fields. I’m probably using the code wrong…

I tested your code with a custom field ‘Opleiding’ which I added in WordPress: Users -> Profile fields:

Screenshot with the custom field

I added this to bp-custom.php:

<?php

function bptest_show_opleiding_field () {
	$opleiding_field = bp_get_member_profile_data( 'field=Opleiding' ); 
	if ( ! $opleiding_field  ) { 
	   return; 
	}   
	else {
	   echo '<span class="custom-field-text">' . $opleiding_field . '</span>'; 
	}
}

add_action ( 'user_opleiding_field', 'bptest_show_opleiding_field' );
?>

Then I added this to order.php (the php file where the custom field should pop-up):

 <div id="user-opleiding">
	                           <?php 
		                          do_action ( 'user_opleiding_field' ); 
	                           ?>
                             </div>

What am I doing wrong? It’s probably a typo or a wrongly added term… But I can’t figure out what it is!

Hope you can help us out! Thanks for the help so far!

David

Skip to toolbar