Looking for some guidance on adding the author’s twitter icon (the one located in the author box) to the author byline located beneath the title of the post. Ideally, we’d like to have the icon to the right of the authors name? Any guidance you could provide would be greatly appreciated.
Hi,
Please add this code to the author function – http://screencast.com/t/FkJuKn5Wj
$td_a_target = ' target="_blank"';
$authorMeta = get_the_author_meta('twitter');
$buffy .= '<span class="td-social-icon-wrap td-twitter-author"><a' . $td_a_target . ' href="' . $authorMeta . '" title="Twitter"><i class="td-icon-font td-icon-twitter"></i></a></span>';
And use this custom css in Theme Panel > Custom Css – http://screencast.com/t/0GqehRMNNEiA
.td-twitter-author .td-icon-font {
color: #222;
}
I just add this and it works fine on my side, but please note that I did not checked how it looks on all the post templates, so you may need some additional customization… If you don’t know how to do this I suggest to hire someone to do this for you.
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
$td_a_target = ' target="_blank"';
$authorMeta = get_the_author_meta('twitter');
if ($authorMeta != "") {
$buffy .= '<span class="td-social-icon-wrap td-twitter-author"><a' . $td_a_target . ' href="' . $authorMeta . '" title="Twitter"><i class="td-icon-font td-icon-twitter"></i></a></span>';
}
Add an if statement after you grab the author meta field to check if it exists first, then if it does, add the icon. That basically says, “If $authorMeta variable is not empty, then do $buffy.” And if it is empty (i.e., author has not entered a Twitter handle) it’ll do nothing extra.
Just a tip. Might take a look at if statements on php.net for more.
Has this process changed at all?
Trying to get the Twitter icon to appear in the byline next to the author like this:https://imgur.com/a/gtVo5tR
Hi marcanine,
Please try on this file path -> wp-content/plugins/td-composer/legacy/common/wp_booster/td_module_single_base.php -> https://i.imgur.com/It7KA85.png
I hope this will help you!