I’m making an attempt to show person information from acf up to now the conventional textual content, radio and choose and date fields show if I take advantage of the next:
<?php $current_user = wp_get_current_user(); echo $current_user->user_gender; ?>
I’ve created 2 picture customized fields one among every I wish to use as an avatar. Ho do I get the pictures to show if the customized area title is user_banner and user_avatar.
the fields are customized fields from acf are user_banner and user_avatar.
Here is the complete code for the web page template:
<?php
/**
Template Title: View Profile
*/
get_header();?>
<part class="page-profile">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<div class="profile-user-info">
<div class="profile-info-row">
<div class="profile-info-name"> Username </div>
<div class="profile-info-value">
<span><?php $current_user = wp_get_current_user(); echo $current_user->user_login; ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name"> First Title </div>
<div class="profile-info-value">
<span><?php $current_user = wp_get_current_user(); echo $current_user->user_firstname; ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name"> Final Title </div>
<div class="profile-info-value">
<span><?php $current_user = wp_get_current_user(); echo $current_user->user_lastname; ?></span>
</div>
</div>
<div class="hr hr-8 dotted"></div>
<div class="profile-info-row">
<div class="profile-info-name"> E-mail </div>
<div class="profile-info-value">
<a href="mailto:<?php $current_user = wp_get_current_user(); echo $current_user->user_email; ?>"><?php $current_user = wp_get_current_user(); echo $current_user->user_email; ?></a>
</div>
</div>
<div class="hr hr-8 dotted"></div>
<div class="profile-info-row">
<div class="profile-info-name"> Gender </div>
<div class="profile-info-value">
<span><?php $current_user = wp_get_current_user(); echo $current_user->user_gender; ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name"> Age </div>
<div class="profile-info-value">
<span><?php $current_user = wp_get_current_user(); echo $current_user->user_birthday; ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name"> Nation</div>
<div class="profile-info-value">
<span><?php $current_user = wp_get_current_user(); echo $current_user->user_country; ?></span>
</div>
</div>
</div>
<?php
$imgurl = get_field('user_banner',$user->ID);
if (filter_var($imgurl, FILTER_VALIDATE_URL) === FALSE)
{
$imgurl = wp_get_attachment_url($imgurl);
}
echo '<img src="' . $imgurl . '" alt="picture">';
?>
<?php
$imgurl = get_field('user_avatar',$user->ID);
if (filter_var($imgurl, FILTER_VALIDATE_URL) === FALSE)
{
$imgurl = wp_get_attachment_url($imgurl);
}
echo '<img src="' . $imgurl . '" alt="picture">';
?>
</div>
</div>
</div>
</part>
<?php get_footer(); ?>
The code for the picture used I obtained someplace however once I examine it reveals the under:
kindly Help, Thanks.