Forums

[Plugin: WP-Twitter] hack to allow custom tweets different from post titles (1 post)

  1. buskerdog
    Member
    Posted 2 years ago #

    I use WP to manage an art site so the titles of posts (the names of paintings) make lame tweets. Instead, I'd rather the tweets say something like "Check out my latest painting of blah blah blah http://url"

    So I did a bit of hacking to wp-twitter.php:

    Right before the line
    $message = $title . " - " . $url_contents;

    I added:
    if($_POST['wp-twit-alt'] != '' ) { $title = $_POST['wp-twit-alt']; }

    And right after
    echo "<div class=\"inside\">".__('Activate', 'wp-twitter')." <em>WP-Twitter</em> ".__('to this post', 'wp-twitter')."?<p> ";

    I added
    echo "Alternate Tweet text (optional): <input name=\"wp-twit-alt\" id=\"wp-twit-alt\" type=\"text\" maxlength=\"100\"></p><p> ";

    Now there's a little text field that you can add an alternate tweet text to. If you leave it blank then it just does the regular thing.

    I originally had the text field allow up to 134 characters but something weird was happening so I shortened it to 100 and it works fine!

Topic Closed

This topic has been closed to new replies.

About this Topic