• Resolved codeink

    (@codeink)


    We are having an issue where the author(s) set on the post edit screen do not match what is seen on the front-end of the website. This is happening for many posts, but not all. For the ones it is happening on, it’s showing the same author (of which, this author is only assigned to one post)

    This is our code:

    <?php if ($authors = get_multiple_authors()) : 
            //var_dump($authors); ?>
            <?php $expertsArray = array(); ?>
            <?php $authorsArray = array(); ?>
            <div class="video-author-box">
                <div class="heading-text">
                    <?php foreach ($authors as $author) : 
                        ?>
                        <?php if (user_can($author->ID, 'publish_posts')) {
                            array_push($authorsArray, $author);
                        } else {
                            array_push($expertsArray, $author);
                        } ?>
                    <?php endforeach; ?>
    
                    <h3><?php echo sprintf(__('Meet the %1$s', 'mdcom'), authorOrExperts($expertsArray, $authorsArray)); ?></h3>
                </div>
                <?php foreach ($authors as $author) : 
                    ?>
                    <div class="author-info">
                        <?php $image = is_array($author->get_avatar_url(82)) ? $author->get_avatar_url(82)['url'] : $author->get_avatar_url(82); ?>
                        <div class="image"><img src="<?php echo $image; ?>" height="82" width="82"></div>
                        <div class="content">
                                  <span class="author">
                                    <a href="<?php echo esc_url(get_author_posts_url($author->ID)); ?>"><?php echo $author->display_name; ?></a>
                                  </span>
                            <p class="text author-bio"><?php echo wp_kses_post($author->description); ?></p>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Incorrect Author Showing’ is closed to new replies.