[Resolved] Only display custom field if not empty
Using this in member-header.php :
<div>Location: <?php bp_member_profile_data( 'field=Location' ); ?></div>
But I only want to show this div when the Location field is occupied.
A usual way to do it in WP with a custom field using post meta would be something like :
<?php if($location = get_post_meta(get_the_ID(), 'location', true)): ?><div>Location: <?php echo $location; ?></div>
But I don’t know how to check for this particular field within buddypress as I’m not sure how these fields are being stored as variables, or where they are being stored. In fact I haven’t seen any database queries anywhere on my buddypress journey yet which makes a nice change as it happens 😉
- The topic ‘[Resolved] Only display custom field if not empty’ is closed to new replies.