Hello,
I am really new at php , so sorry for this very basic question;
i have created a new field ‘image’ for users ‘freelancer’.
Then, I try to display the result on each profile page.
THis is where I am stuck.
I tried this:
<?php the_field('badge', 'user_id'); ?></p>
and i really don’t know how to do the echo.
I als tried this:
<?php
$image = get_field('$badge_id', '$user_id');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" />
<?php endif; ?>
<?php
$image = get_field('badge');
echo '<pre>';
var_dump( $badge );
echo '</pre>';
?>
I also tried the var_dump and it returns BOOL(FALSE)
Anyone, please can help?
Many thanks, and sorry again for this very basic question i guess!
Sonia
I got this message on the front end :
NOTICE: UNDEFINED VARIABLE: BADGE IN /HOME/PROFILE.PHP ON LINE 43
NULL
Thank you for your help
Hi @soniadm
The problem in this scenario is that, either you do not have a custom field named badge or you have not set the field group which contains the field badge to show on the homepage.
I hope this helps.