• I’ve been using AutoTwitter with zero problems, everything works great and it does just what I wanted: auto tweets my posts.

    However, I’d like to add a standard phrase and hashtag to every tweet, but don’t know enough php to do it myself. I played with the message code, broke it, fixed it, then came here. Please help.

    I want my tweets to look like this:

    Just blogged: “post title” “post link” #tatting #fb

    The code I’m looking at is from the function.php file:

    //runs when you publish a new post from new or from draft
    function tweet_post($post) {
    $post_ID = $post->ID;
    //prevents tweets to updates
    if( $_POST[‘post_status’] == ‘publish’ && $_POST[‘original_post_status’] != ‘publish’ )
    { global $wpdb;
    $sql = “SELECT post_title FROM $wpdb->posts WHERE ID = $post_ID;”;
    $post_title = $wpdb->get_var($wpdb->prepare($sql));
    $post_title .= ‘ ‘;
    $short_url = shorten_url(get_permalink($post_ID));
    if (strlen($post_title) + strlen($short_url) > 140)
    {
    $total_len = strlen($post_title) + strlen($short_url);
    $over_flow_count = $total_len – 140;
    $post_title = substr($post_title,0,strlen($post_title) – $over_flow_count – 3);
    $post_title .= ‘…’;
    }
    $message = $post_title . $short_url;
    tweet($message);
    return $post_ID;
    }
    }

    I think I’m supposed to be modifying the last few lines where the message is, but that is what broke it. What do I need to do? Am I in the wrong place entirely?

    Any help here is appreciated. Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to edit AutoTwitter message’ is closed to new replies.