How to Display an Author’s Twitter and Facebook in WordPress

How to Display an Author’s Twitter and Facebook in WordPress

Do you wish to display your author’s Twitter and Facebook hyperlinks on your WordPress profile page? Unfortunately, the WordPress user profile page does not have any fields to add Facebook or Twitter profiles by default. But to help you ease things out, we have come with a short tutorial showing how you can easily display an author’s Twitter and Facebook in WordPress with Yoast SEO. So, without any further ado, let’s get right into the tutorial.

Display an Author’s Twitter and Facebook in WordPress with Yoast SEO

First of all, you need to install the Yoast SEO plugin from wordpress.org. And if you are already using Yoast SEO plugin on your website, then you are in luck as it can be used to add Twitter and Facebook profile fields in an author’s profile page.

However, the problem is that Yoast does not automatically display them in the author’s bio. Therefore, we are going to show you how you can add them manually.

Once you have set up the Yoast plugin, you need to visit your WordPress dashboard and then click the Users > All Users page. Then, click on the Edit link below the author’s name.

You might notice new Facebook and Twitter profile fields on the user’s profile page under the ‘Contact Info‘ option. Not only Facebook and Twitter, but you can also add in your other social media links like Instagram, LinkedIn, Tumblr, and many more,

For Twitter, you just need to enter the user handle without the “@” symbol. And for Facebook, you will need to enter the complete Facebook profile URL. Along with your social media links, you can also jot down your bio, display name, and more on the same page.

Facebook and Twitter ID

Once you are done pasting the URLs on their respective fields, click on the ‘Update Profile‘ button to store your changes. Now, you need to display these fields as links in your theme. You can do this by adding the following code to your theme files where you want to display the author profile links.

$twitter = get_the_author_meta( 'twitter', $post->post_author );
$facebook = get_the_author_meta( 'facebook', $post->post_author );
echo '<a href="https://twitter.com/' . $twitter .'" rel="nofollow" target="_blank">Twitter</a> | <a href="'. $facebook .'" rel="nofollow" target="_blank">Facebook</a>';
 

Save your modifications and view a post on your website written by the author you just modified.

Here is how it will look after you save all your changes.

We hope this article helped you learn how you can display an author’s Twitter and Facebook in WordPress with Yoast SEO.

If you have anything to add or share, feel free to drop your comments down below.

 

Leave a Reply

Your email address will not be published. Required fields are marked *