WordPress.org

Ready to get started?Download WordPress

Forums

Twitter Tools
long permalinks kill tweets - short work also tweet box (12 posts)

  1. NPSites
    Member
    Posted 3 years ago #

    hey i like to have my urls with my domain that way they point back to my site...

    In a previous version pre-oAuth I hacked your plugin to use the Post ID and that worked ... I have not started hacking at your plugin again because I just installed it.

    Tweeting short Post Names works ie http://www.mysite.com/test.php
    But when i use a real permalink the tweet crashNburns probably because its over 140 char

    I can also tweet from the direct tweet box from the Posts menu so i know my connection is good

    I really dont like using url shorteners because it cuts down on back links which are very important for google rank even if they are postID urls.. better then using someone else's domain.

    ANYWAY

    maybe i will hack on it later today or tonight and then release a plugin for your plugin but it really should be a basic option to use PostID when the Permalink is too long...

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

  2. Alex King
    Member
    Plugin Author

    Posted 3 years ago #

    You can write a plugin for Twitter Tools to do this (see the included examples), no need to hack it each time.

  3. undershirtguy
    Member
    Posted 3 years ago #

    hey npsites, did you wind up creating that plug-in you mentioned?

    i had the exact same problem where my posts weren't being sent to twitter because of the permalink being too long and the 140 char limit on twit.

    i created a post called "test", which made the url look like mydomain.com/test, published it, and it got sent to twitter just fine via twitter tools.

    also, like you, i'd rather use my domain name and post id vs. bit.ly links.

    let me know if you wound up creating something to work with twitter tools.

  4. NPSites
    Member
    Posted 3 years ago #

    well I tried to apply a filter but I have not had success yet

    If you need a fix edit line 489 in TwitterTools to be

    //		$url = apply_filters('tweet_blog_post_url', get_permalink($post_id));
    
    		$url = apply_filters('tweet_blog_post_url', get_settings('home') .'/?p='. $post_id);

    I am going to try to figure out why $post_id does not get picked up when I put it in the functions.php file

    probably a global thing

    function ttpidurl($url) {
    $url = get_settings('home') .'/?p='. $post_id;
    return $url;
    }
    
    add_filter('tweet_blog_post_url', 'ttpidurl');
  5. richardxthripp
    Member
    Posted 3 years ago #

    Try global $post; $post_id = $post->ID;. Also, make the top line function ttpidurl() { because you are not using the $url parameter.

  6. undershirtguy
    Member
    Posted 3 years ago #

    thanks npsites & richardx!

    npsites, if you get the functions.php to work with the suggestion from richardx, would you mind posting the final code here so i can try it out and we can share with everyone else who is likely having the same problem with twitter tools. i was reading through their forums and seems like lots of people have the problem, but no one posted any resolution and the plug-in developer hasn't responded recently either.

    thanks!

  7. Nightwyrm
    Member
    Posted 3 years ago #

    So does this mean there's a known bug with the plugin? All my posts are tweeted fine, except for ones with long URLs. Tried it with the bit.ly plugin and without, but the URLs aren't being shortened, therefore the post isn't tweeted.

  8. undershirtguy
    Member
    Posted 3 years ago #

    i haven't applied the fix recommended above, but i'm manually sending tweets to twitter using the same method (using the postid instead). plug-in seems to work for short urls. my assumption is that it has to do with tweet length restrictions. if the text + url combined is longer than what twitter accepts, twitter tools won't be able to send the tweet.

    i'm not sure what happened along the way, but twitter tools used to shorten the url before posting to twitter. can't seem to figure out why that stopped working after the upgrade.

  9. buffalokill
    Member
    Posted 3 years ago #

    Thanks Guys!

    I added this to my functions.php file

    function ttpidurl() {
    global $post; $post_id = $post->ID;
    $url = get_settings('home') .'/?p='. $post_id;
    return $url;
    }
    add_filter('tweet_blog_post_url', 'ttpidurl');

    And modified the twitter-tools.php file on line 489 as suggested above, and it has worked fine.

  10. myopicmike
    Member
    Posted 3 years ago #

    Don't suppose anyone could help me figure out what they did here?

    I'd like for Twitter Tools to tweet either A) domain.ext/p=## link, or B) a bit.ly link pointing to the p=## permalink.

    The functions.php addition is for the theme's functions.php? I figured TT worked all on the backend and wouldn't pick up anything there...

    and when buffalo made the change on the plugin's line 489, was it NPSites' change? or richard's below it? 'cause I'm not quite sure what richard suggested we change...

    change
    $url = apply_filters('tweet_blog_post_url', get_settings('home') .'/?p='. $post_id);

    to this?

    $url = global $post; $post_id = $post->ID;

    (gonna try a few of these myself but...if someone can clear it up ab it for me, man you'd be awesome.)

    Edit: Figgered out how to make it spit out domain.ext/p=## tweets. Working on making it bit.lyfy that link as well -- I think it's as simple as putting the same fix on the bit.ly plugin. >.>;

  11. myopicmike
    Member
    Posted 3 years ago #

    and then I broke it...accidentally hit shift-page down instead of shift-end and deleted, and when I clicked 'refresh' to undo the changes, I think it saved the changes for me...

    of course, now I keep getting and error message. Using this code:

    // $url = apply_filters('tweet_blog_post_url', get_permalink($post_id));
                       $url = apply_filters('tweet_blog_post_url', global $post; $post_id = $post->ID;);

    nets this error:

    Parse error: syntax error, unexpected T_GLOBAL in (domain-level-folder-stuff-that-has-a-username)/html/erfblog/wp-content/plugins/twitter-tools/twitter-tools.php on line 490

    So, naturally...I forgot what I even did. head => desk. =\
    `

  12. richardxthripp
    Member
    Posted 3 years ago #

    It sounds like you made a syntax error or declared a global in the wrong place. Check your code carefully!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic