I'm not sure why there is no result with advance custom fields. i use get_the_author_meta('ID') for other information since it's work with single.php but i want also to display the information of author / grantor in author or profile page but no result. Any idea please check my code below.

<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
    <div class="infomation-section">
          <?php $user_id = get_the_author_meta('ID'); ?>
        <h3 class="info-title">Grantor Informations</h3>
        <div class="info-grantor-info">
        <div class="info-image">
            <?php echo get_avatar(get_the_author_meta( 'ID' ), 100); ?>
            <h3 class="info-name"><?php the_field('grantor_name', 'user_'.$user_id);?></h3>
            <p class="info-address">
                <?php the_field('full_address', 'user_'.$user_id);?>
        <?php if (get_field('telephone_number', 'user_'.$user_id)) : ?>
        <div class="info-number">
            <h4>Telephone Number:</h4>
            <p><?php the_field('telephone_number', 'user_'.$user_id);?></p>
        <?php endif; ?>
        <?php if (get_field('fax_number', 'user_'.$user_id)) : ?>
        <div class="info-number">
            <h4>Fax Number :</h4>
            <p><?php the_field('fax_number', 'user_'.$user_id);?></p>
        <?php endif; ?>
        <?php if (get_field('email_address', 'user_'.$user_id)) : ?>
        <div class="info-email">
            <h4>Email Address :</h4>
            <p><?php the_field('email_address', 'user_'.$user_id);?></p>
        <?php endif; ?>
    <div class="program-section">

i solve this problem by using this code

<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>

<?php the_field('grantor_name', 'user_'.$curauth->ID)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.