Post info or entry meta in the entry header in Genesis shows published date, author link, link to comments and edit link by default. What if you want to display post author's Twitter link in the post info?
In this article I share the code to
- load Dashicons (we are going to use its font icon to show Twitter icon before the Twitter link)
- use user_contactmethods filter to add Twitter field in User Profile page in WP admin
- create [twitter_link] shortcode which outputs post author's @twitterhandle linking to https://twitter.com/twitterhandle. If @ is entered by the user in his/her profile field, it will be stripped.
- use genesis_post_info filter to customize entry meta on single Post pages in the entry header so it displays author link, post date, twitter link and edit link.
functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Hey Srikat,
Another awesome post as usual!
Just a query; is the code for Dashicons correct?
I’ve used your code as specified but I don’t see the icon on http://traffictrain.in/most/
Apologies, looks fine now.
Question: is it possible to remove the @username and use the just the Twitter icon itself to link to the Twitter handle?
Yes.
http://pastebin.com/raw.php?i=6jn0t9JM
http://pastebin.com/raw.php?i=yN9H76HZ
http://cl.ly/image/0k3r3V100f0P
Great tutorial!
Small conflict with Genesis Simple Share – the css from this tutorial
.twitter:before {}
is adding a second twitter bird to the Simple Share twitter link.How do I rename .twitter:before in the php to avoid the conflict?
Change http://pastebin.com/raw.php?i=u1mHhEj3 to http://pastebin.com/raw.php?i=Teth3LUc.
Then in the CSS, replace ‘twitter’ with ‘twitter-handle’.
I noticed the twitter bird “floating” above Simple Share as well. The above changes fixed the problem. However, in my case the function is not re-writing the post_info. I am not sure that it not a theme problem. Can you take a look?
URI: http://lwumc.org/homecoming/
Theme: KIckstart-pro
That works a treat! Plus I learned the
controls the css class. Thank you so much!