Forums

Twitter Tools
include URL to original tweet (4 posts)

  1. Justin Sternberg
    Member
    Posted 5 months ago #

    Would it be possible to add to the importer the ability to include a link to the actual tweet on twitter.com? I'm using this plugin to backup my twitter profile, and the only bummer is that I have no way of getting back to that tweet on twitter.com.

    http://wordpress.org/extend/plugins/twitter-tools/

  2. Justin Sternberg
    Member
    Posted 5 months ago #

    Ooh, just enabled custom-fields in the screen options and saw that the tweet id is saved, so i can use that to generate the urls. You guys are awesome! :)

  3. Justin Sternberg
    Member
    Posted 5 months ago #

    For anyone looking for this same feature, here's a function you can use to replace the_permalink, if you want to send it to the twitter unique tweet url.

    function twitter_permalink( $echo = true ) {
    global $post;
    
    	$twitter_username = sanitize_title_with_dashes( get_option( 'aktt_twitter_username' ) );
    	$tweet_id = get_post_meta( $post->ID, 'aktt_twitter_id', true );
    	$twitter_permalink = 'http://twitter.com/'. $twitter_username .'/status/'. $tweet_id;
    
    	if ( $echo == false )
    		return $twitter_permalink;
    	else
    		echo $twitter_permalink;
    }

    And to use it in your code, something like this:
    <a href="<?php twitter_permalink(); ?>" target="_blank">view on twitter</a>

    Or to return it in function, something like this:

    $twitter_permalink = twitter_permalink( false );
    echo '<a href="'. $twitter_permalink .'" target="_blank">view on twitter</a>';
  4. Alex King
    Member
    Posted 5 months ago #

    Or you could use the built-in aktt_status_url() method... and you'd be better off using esc_url() on the final URL than sanitizing the username on retrieval.

Reply

You must log in to post.

About this Plugin

About this Topic