Display Author's Twitter Username
-
Hello,
I am trying to make an author box that displays the author’s Twitter username if it’s available. I tried copying this code:
<?php if (get_the_author_url()) { ?><a class="author-website" href="<?php the_author_url(); ?>">Website</a><?php } ?>
and replacing
get_the_author_url()
withthe_author_meta('twitter')
but for some reason it just outputs my Twitter username (and yes I put twitter.com/ in the href). How can I get this to work?PS: I am not very good with PHP so an explanation would be grateful! ?? Thank you!
EDIT:
I just noticed thatget_the_author_url()
has been replaced withthe_author_meta('user_url')
and now that only displays the URL. How can I create an “if statement” for both the website and Twitter username? Thanks!
- The topic ‘Display Author's Twitter Username’ is closed to new replies.