[Plugin: Tweetbacks] Hack to identify custom shorturls: site.com/?p=postid (Add to core?) (2 posts)

  1. Joen Asmussen
    Posted 6 years ago #


    All the "Tweet This" plugins out there are totally bloated, so I wanted my own simple tweet this function call:

    <a href="http://twitter.com/home/?status=<?php the_title(); ?>: <?php echo get_bloginfo('url') . '/?p=' . get_the_ID(); ?>">Tweet This</a>

    Very simple eh? It tweets the title of the post, and your URL in the format of "http://mywebsite.com/?p=4571" where 4571 is the id of the post. Works fine.

    Problem is: TweetBacks doesn't pick up this URL.

    I've tried to add a hack to the plugin to search for this URL, and while I haven't tested it, I figured I'd write it down here in hopes the author will add something like this to the core:

    Edit "tweetbacks.php".

    At line 413, insert this:

    // Hack to add custom shorturls
    if (!isset($shorturls['shortpermalink'])) {
    	$shorturls['shortpermalink'] = get_bloginfo('url') . '/?p=' . get_the_ID();

    This should add another array entry to the list of URLs to search for.


  2. Joen Asmussen
    Posted 6 years ago #

    As a small update to this, I can confirm that this hack does in fact work.


    The second tweetback uses the custom type of shortlink.

Topic Closed

This topic has been closed to new replies.

About this Topic