• Resolved desben

    (@desben)


    Hello everybody ??

    I’m not good at all in PHP, I’ve already dabbled in a few little things but always taking long hours. Today I am faced with something that I am incapable of doing.

    At the bottom of each article on my site, I display an author summary. I would like to be able to add the Twitter (and other RS) buttons configured on the author’s Ultimate Members profile, but I don’t know how to do it.

    Do you have anything to advise me?

    Here is my current code to display the author block:

    <div id="author-meta">
    <div id="avatar-author-meta"><?php echo get_avatar( get_the_author_meta('ID'), 100 ); ?></div>
    <div id="content-author-meta"><div id="auteur">Contenu proposé par <?php the_author_posts_link(); ?></div>
    <span class="number-posts"><?php the_author_posts(); ?> articles</span>
    <p class="description-auteur"><?php the_author_meta('description'); ?></p></div>
    </div>

    Thank you in advance and good day ??

    • This topic was modified 9 months, 3 weeks ago by desben.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter desben

    (@desben)

    Update! I finally found how to do it ?? Here is the solution for those who need it:

        <div id="author-meta">
            <div id="avatar-author-meta">
                <?= get_avatar(get_the_author_meta('ID'), 100); ?>
            </div>
            <div id="content-author-meta">
                <div class="author-and-links">
                    <div id="auteur">Contenu proposé par <?= the_author_posts_link(); ?></div> - <div class="social-links">
                        <?php $twitter = get_the_author_meta('twitter');
                    $linkedin = get_the_author_meta('linkedin');
        if ($twitter) {
            echo '<a href="' . esc_url($twitter) . '" target="_blank"><i class="fa-brands fa-x-twitter"></i></a>';
        }
                
        if ($linkedin) {
            echo '<a href="' . esc_url($linkedin) . '" target="_blank"><i class="fa-brands fa-linkedin-in"></i></a>';
        }
        ?>
                    </div>
                </div>
                <span class="number-posts"><?= the_author_posts(); ?> articles</span>
                <p class="description-auteur"><?= the_author_meta('description'); ?></p>
            </div>
        </div>
Viewing 1 replies (of 1 total)
  • The topic ‘Use the Twitter field elsewhere on the site ?’ is closed to new replies.