前端页面分享twitter_如何在个人资料页面上显示作者的Twitter和Facebook

前端页面分享twitter

Do you want to display your author’s Twitter and Facebook links on their WordPress profile page? By default, WordPress user profile page does not have any fields to add Facebook or Twitter profiles. In this article, we will show you how to easily display author’s Twitter and Facebook profile links in WordPress.

您是否要在其WordPress个人资料页面上显示作者的Twitter和Facebook链接? 默认情况下,WordPress用户个人资料页面没有任何可添加Facebook或Twitter个人资料的字段。 在本文中,我们将向您展示如何轻松地在WordPress中显示作者的Twitter和Facebook个人资料链接。

How to Add Author's Twitter & Facebook in WordPress Profile Page

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

1.使用Author Bio Box添加Twitter和Facebook个人资料 (1. Add Twitter and Facebook Profiles with Author Bio Box)

This method is easier and is recommended for all users.

此方法更简单,建议所有用户使用。

First, you need to install and activate the Author Bio Box plugin. For more details, see our step by step guide on how to install a WordPress plugin.

首先,您需要安装并激活Author Bio Box插件 。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to visit the Settings » Author Bio Box page in your WordPress admin to configure plugin settings.

激活后,您需要访问WordPress管理员中的“设置”»“作者生物文件夹”页面以配置插件设置。

Author bio box

First you need to select where you want to display the author bio box. The plugin can automatically show the author bio box below posts only or below posts and on homepage.

首先,您需要选择要显示作者简介框的位置。 该插件可以自动在仅帖子下方或帖子下方以及主页上显示作者简介框。

After that you can select background color, text color, gravatar size, border, etc.

之后,您可以选择背景颜色,文本颜色,图像大小,边框等。

Don’t forget to click on the save changes button to store your settings.

不要忘记单击“保存更改”按钮来存储您的设置。

Next, you need to go to the Users » All Users page. Here you need to click on the edit link below the user account.

接下来,您需要转到用户»所有用户页面。 在这里,您需要单击用户帐户下方的编辑链接。

Edit author profile

This will bring you to the user’s profile page. You will notice that there are new social profile fields available on this page.

这将带您进入用户的个人资料页面。 您会注意到此页面上有新的社交资料字段。

Now you just need to enter the author’s Facebook, Twitter, or any other social media profile URLs in the respective fields.

现在,您只需要在相应字段中输入作者的Facebook,Twitter或任何其他社交媒体个人资料URL。

Enter your social profile URLs

Once you are done, click on the update profile link.

完成后,单击更新配置文件链接。

You can now view any posts written by that user, and you will see their author bio box with icons for their Twitter, Facebook, and other social media profiles.

现在,您可以查看由该用户撰写的任何帖子,并且您将看到其作者的生物方框,其中带有其Twitter,Facebook和其他社交媒体个人资料的图标。

Author bio box with social profiles

Registered users on your WordPress site can also edit their own profiles to add links for their Facebook and Twitter pages. You can also send an email to all registered users on your website and ask them to update their profiles.

WordPress网站上的注册用户还可以编辑自己的配置文件,以为其Facebook和Twitter页面添加链接。 您还可以网站上的所有注册用户发送电子邮件,并要求他们更新其个人资料。

2.使用Yoast SEO显示Twitter和Facebook个人资料 (2. Display Twitter and Facebook Profiles with Yoast SEO)

This method is for advanced users because it will require you to edit WordPress theme files. If you haven’t done this before, then check out our guide on how to copy and paste code in WordPress.

此方法适用于高级用户,因为它将要求您编辑WordPress主题文件。 如果您以前没有做过,请查看有关如何在WordPress中复制和粘贴代码的指南。

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 author’s profile page.

如果您已经在网站上使用Yoast SEO插件,那么您很幸运,因为它可用于在作者的个人资料页面中添加Twitter和Facebook个人资料字段。

The problem is that Yoast does not automatically display them in the author bio, but don’t worry we will show you how to do that.

问题在于,Yoast不会自动在作者简介中显示它们,但是请放心,我们将向您展示如何做到这一点。

Related: How to properly install and setup Yoast SEO plugin on your website.

相关: 如何在您的网站上正确安装和设置Yoast SEO插件

Once you have Yoast plugin setup, you need to head over to the Users » All Users page, and then click on the edit link below the author name.

安装Yoast插件后,您需要转到“ 用户»所有用户”页面,然后单击作者名称下方的编辑链接。

Edit author profile

On the user’s profile page, you will notice new Facebook and Twitter profile fields. For Twitter, you just need to enter the user handle without @ symbol.

在用户的个人资料页面上,您会注意到新的Facebook和Twitter个人资料字段。 对于Twitter,您只需要输入不带@符号的用户句柄。

For Facebook, you will need to enter the complete Facebook profile URL.

对于Facebook,您需要输入完整的Facebook个人资料URL。

Facebook and Twitter fields in user profile

Once you are done, 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.

您可以通过在想要显示作者个人资料链接的主题文件中添加以下代码来做到这一点。


<?php 
$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 changes and view a post on your website.

保存您的更改并查看您网站上的帖子。

Here is how it looked on our demo website.

这是在我们的演示网站上的外观。

Author social profile links

We hope this article helped you learn how to display author’s Twitter and Facebook profile links in WordPress. You may also want to see our list of how to show an authors list with photos in WordPress.

我们希望本文能帮助您学习如何在WordPress中显示作者的Twitter和Facebook个人资料链接。 您可能还想查看我们的列表, 列表显示如何在WordPress中显示带有照片的作者列表

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-display-authors-twitter-and-facebook-on-the-profile-page/

前端页面分享twitter

  • 0
    点赞
  • 0
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值