I would like to modify the following lines of code, taken from Version 2.1 of NewsMag theme.
My intention is to add a link to the post author’s twitter account, instead of the usual link to their post archives.
I am editing line 66 to 78 of the file ‘td_module_single_base.php’ in ‘includes/wp_booster’.
I have tried to use the WordPress function get_the_author_meta(‘twitter’, $author_id) as follows, but I cannot get it to work with the way the code has been concatenated.
Any help would be appreciated.
Here is the non-functioning code:
$buffy .= ‘‘ . get_the_author_meta(‘display_name’, $this->post->post_author) . ‘‘ ;
EDIT : I can’t display the code correctly, but the line I wish to show is line 70.
-
This topic was modified 10 years by
Andrex. Reason: Using the code tags didn't work!
-
This topic was modified 10 years by
Andrex.
-
This topic was modified 10 years by
Andrex.
-
This topic was modified 10 years by
Andrex.
-
This topic was modified 10 years by
Andrex.
-
This topic was modified 10 years by
Andrex.
-
This topic was modified 10 years by
Andrex.
Hi
You can directly add your twiter link in that function like here: http://screencast.com/t/3e9BXQqf – http://screencast.com/t/Qv5hxIaQ23 Also you can try using this function: get_the_author_meta( 'twitter')
Thanks!
Manually adding the whole link does not work, since each individual author will have their own twitter account – the intention is not to link it to the site’s main twitter account.
I have also already included get_the_author_meta('twitter') to no avail – it does not work within the way this code has been constructed.
You can see my code here: http://touringcars.net/Screengrab-td_module_single_base.png – this just adds a link to ‘https://www.twitter.com’, but I’d like it to link to ‘https://www.twitter.com/TWITTER USERNAME’.
Can you offer any other solutions? I#m sure this should be a fairly minor issue.
Thanks for your help
-
This reply was modified 10 years by
Andrex. Reason: Thank you
Hi
Replace the indicated line of code with this one: http://screencast.com/t/35EQKm4SguM
$buffy .= '<a href="' . get_the_author_meta('twitter', $this->post->post_author) . '">' . get_the_author_meta('display_name', $this->post->post_author) . '</a>' ;
You have to add your twitter link at user profile like this: http://screencast.com/t/rcGmxQxp The result should be like here: http://screencast.com/t/IVLCKWfpIu
Let me know how it goes.
Thanks!
-
This reply was modified 10 years by
Andrei L..