I made these changes to add the URL (changes in bold):
//get the hashtag (we need the id of the parent blog post, not $post->ID here)
$parent_post_id = (int)$_POST['live_blogging_entry_post'];
$hashtag = get_post_meta($parent_post_id, "liveblogging_hashtag", true);
<strong>$permalink = get_permalink( $parent_post_id );</strong>
//how much space do we have?
if ($hashtag) {
$tweetlength = 140 - strlen($hashtag)<strong>- strlen($permalink</strong>)- 2;
} else {
$tweetlength = 140;
}
//do I need to trim the tweet?
if (strlen($content) > $tweetlength) {
$content = substr($content, 0, $tweetlength - 1)
. html_entity_decode('…', ENT_COMPAT, 'UTF-8');
}
//add hashtag and permalink
if ($hashtag)
{
$content .= " #" . $hashtag<strong>." ".$permalink</strong>;
}
[Moderator Note: Please post code or markup snippets between backticks or use the code button.]