lundi 28 octobre 2019

WordPress if author of post is do something

How do I check who the author of the current post that is being viewed is? I am trying to create a custom author box, where a specific author named Vivian should have a specific a-tag when displaying her name. The rest should just have the same H3.

I have tried with the_author and get_the_author_meta display name in an IF and else statements but it doesn't seem to work. What am I missing?

    <div class="media-body">
        <?php if (the_author('vivian')) { ?>
    <a href="https://example.com/about/"><h3>VIVIAN SOMETHING</h3></a>
<?php } else { ?>
    <h3>A random title</h3>
<?php } ?>
        <p><?php the_author_meta('description'); ?></p>
    </div>

Aucun commentaire:

Enregistrer un commentaire