Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Tom

    (@tomasz_b)

    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(); ?>
    </div>

    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?

    Anyone?

    Thread Starter Tom

    (@tomasz_b)

    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:

    <?php
    if (function_exists('get_comment_author_twitter_id')) {
    	$twittername = get_comment_author_twitter_id($comment_id);
    		if ( $twittername ) {
    			echo '<a rel="nofollow" href="';
    			comment_author_twitter_url($comment_id);
    			echo '">(';
    			comment_author_twitter_id($comment_id);
    			echo ')</a>';
    		}
    }
    ?>
    Plugin Author Sudar Muthu

    (@sudar)

    Nice to know that you figured it out.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to use the template functions to add link to Twitter?’ is closed to new replies.