Group Admins

  • Profile picture of Steve

WordPress Troubleshooting and Support

Public Group active 3 months, 2 weeks ago ago

WordPress support from our community

Add hashtag automatically to live blog tweet

This topic contains 0 replies, has 2 voices, and was last updated by  Kevin Cristiano 7 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #1305


    Hi. I’ve been live blogging WordCamp Philly using the Live Blogging plugin from Chris Northwood (who is no longer actively developing it). I want to add to the following code the ability to pull a custom field entitled “hashtag” from the original post and append it to the end of the tweet.

    Does anybody know how I would go about this? I searched on the codex and tried to add the code based on what I found there, but it returned errors.

    add_action(‘publish_liveblog_entry’, ‘live_blogging_tweet’, 10, 2);
    function live_blogging_tweet($id, $post)
    if (‘1’ == get_option(‘liveblogging_enable_twitter’) && ” == get_post_meta($id, ‘_liveblogging_tweeted’, true))
    $connection = new TwitterOAuth(LIVE_BLOGGING_TWITTER_CONSUMER_KEY, LIVE_BLOGGING_TWITTER_CONSUMER_SECRET, get_option(‘liveblogging_twitter_token’), get_option(‘liveblogging_twitter_secret’));
    $content = filter_var($post->post_content, FILTER_SANITIZE_STRING);
    if (strlen($content) > 140)
    $tweet = $connection->post(‘statuses/update’, array(‘status’ => substr($content, 0, 139) . html_entity_decode(‘…’, ENT_COMPAT, ‘UTF-8’)));
    $tweet = $connection->post(‘statuses/update’, array(‘status’ => $content));
    if (isset($tweet->id))
    update_post_meta($id, ‘_liveblogging_tweeted’, $tweet->id);

    Kevin Cristiano

    Take a look at these as examples:

    Search for “hashtag” in the code.

    This can then show you how they do it. Then you can see if you can incorporate their logic into the changes you want in the liveblogging plugin.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.