Twitter Avatar Reloaded
[resolved] How to use the template functions to add link to Twitter? (4 posts)

  1. Tom
    Posted 3 years ago #

    I would like to add the text: "Twitter: @username" to the comments output, with "@username" linking to the users profile. How exactly should I use the template functions to achieve this?


  2. Tom
    Posted 3 years ago #

    I think I am on a good way:

    <div class="the_comment">
    <p><?php comment_author_link(); ?>
    <a rel="nofollow" href="<?php comment_author_twitter_url($comment_id); ?>">
    (Twitter: <?php comment_author_twitter_id($comment_id); ?>)
    </a><br />
    <span class="small-text"><a href="comment-<?php comment_ID(); ?>"><?php comment_date('F d, Y'); ?></a></span></p>
    <?php comment_text(); ?>

    How should I modify this code to make the Twitter link appear only when there is an entry in the database (and only when the plugin is activated - otherwise the comments would not appear at all when the plugin is not active).

    And is there any way to include this field in anti-spam filtering in case a spammer writes the comment here?


  3. Tom
    Posted 3 years ago #

    OK, I got it (by trial and error more or less). It appears to be working fine. In case someone finds it useful, here it is:

    if (function_exists('get_comment_author_twitter_id')) {
    	$twittername = get_comment_author_twitter_id($comment_id);
    		if ( $twittername ) {
    			echo '<a rel="nofollow" href="';
    			echo '">(';
    			echo ')</a>';
  4. Sudar Muthu
    Plugin Author

    Posted 3 years ago #

    Nice to know that you figured it out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Twitter Avatar Reloaded
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic