I wanted Tweetbacks to also find links that used Wordpress' default URLs, as if the Permalinks setting hadn't been changed. For example: mysite.com/blog/?p=123. I did this so that my 'Tweet This' links could be shorter without using a 3rd-party service.
Here's the patch for tweetbacks.php version 1.5:
[modification of function yoast_get_tweetback()]
*** 505,510 ****
--- 505,511 ----
require_once(ABSPATH . WPINC . '/rss.php');
$permalink = get_permalink($post_id);
+ $defaultlink = get_option('home') . '/?p=' . $post->ID;
$shorturls = get_post_meta($post_id,"shorturls",true);
$oldshorturls = $shorturls;
***************
*** 524,529 ****
--- 525,535 ----
$shorturls['permalink'] = $permalink;
}
+ // Add the raw permalink of the post itself, e.g. /blog/?p=123
+ if (!isset($shorturls['defaultlink'])) {
+ $shorturls['defaultlink'] = $defaultlink;
+ }
+
if (!isset($shorturls['tinyurl'])) {
$result = $snoopy->fetch("http://tinyurl.com/api-create.php?url=".$permalink);
if ($result && strpos($snoopy->response_code,"200") !== false && $snoopy->results!="" && strpos($snoopy->results,"http://tinyurl.com") === 0) {
Here's what I put in comments.php for my theme:
<a href="http://twitter.com/home?status=<?php the_title_attribute();?>:+<?php echo get_option('home');?>/%3Fp%3D<?php the_ID(); ?>">Tweet this post</a>
Works a treat.
:)