[Live Blogging] Add hashtag to outgoing tweet
-
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'))); } else { $tweet = $connection->post('statuses/update', array('status' => $content)); } } if (isset($tweet->id)) { update_post_meta($id, '_liveblogging_tweeted', $tweet->id); } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘[Live Blogging] Add hashtag to outgoing tweet’ is closed to new replies.