WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Tom
    Member
    Posted 1 year 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?

    http://wordpress.org/extend/plugins/twitter-avatar-reloaded/

  2. Tom
    Member
    Posted 1 year 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(); ?>
    </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?

  3. Tom
    Member
    Posted 1 year 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:

    <?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>';
    		}
    }
    ?>
  4. Sudar
    Member
    Plugin Author

    Posted 1 year ago #

    Nice to know that you figured it out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags