Post to Twitter when you post to your blog
Filed Under Twitter, Wordpress on 2008-02-25, 12:15
I don’t like doing things manually when I can have software do my bidding. Usually I’ll send a twitter when I have a new blog post on here that I think people are interested in. (I recognize not everyone has my RSS feed in their feed reader…yet) But it’s a manual process and an extra step, so I went out and found Alex King’s Twitter Tools plugin. Alex King is a name forever associated in my head with WordPress, primarily for his help in finding themes back in the early days of WP. This plugin is pretty full-featured:
- Archive your Twitter tweets (downloaded every 15 minutes)
- Create a blog post from each of your tweets
- Create a daily digest post of your tweets
- Create a tweet on Twitter whenever you post in your blog, with a link to the blog post
- Post a tweet from your sidebar
- Post a tweet from the WP Admin screens
- Pass your tweets along to another service (via API hook)
I’ve currently got it set up to send to twitter when a post goes live on here. So in theory, when this post went live, it should have shown on my Twitter page.
UPDATE: Looks like Twitter Tools will post any edits to a posts if that blog post has not been twittered yet. Sorry for the twitter flood when I removed the “Uncategorized” category from a couple old posts. I’m going to look into manually adding the “twittered” metadata to all my posts so it doesn’t happen again.
UPDATE 2: Threw together a quick little php script to update the database so old posts aren’t twittered when they’re edited. YMMV, User beware, no warranty, etc. You’ll want to make a backup of your databases, then fill in your username, password, and database_name and then run this either from command line or via the browser.
/*--------code start--------*/
mysql_connect(localhost, "db_username", "db_password");
mysql_select_db("database_name");
$res1 = mysql_query("SELECT * FROM wp_posts p WHERE (p.post_status LIKE \"publish\")");
while ($row = mysql_fetch_array($res1, MYSQL_ASSOC)) {
//find out if the TwitterTools metadata has already been written
$sql2 = "SELECT * FROM wp_postmeta WHERE (post_id = ".$row['ID'].") && (meta_key LIKE \"aktt_tweeted\") && (meta_value LIKE \"1\")";
print "Post ID: ".$row['ID']."
\n";
if (!mysql_numrows(mysql_query($sql2))) {
//metadata not found, let's fake it without twittering
$sql = "INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (".$row['ID'].",\"aktt_tweeted\",1)";
mysql_query($sql);
print " -- added metadata to fake it.
\n";
} else {
print " -- already been twittered.
\n";
}
}
/*--------code end--------*/
Tagged: blogging, plugins, Social Networking, Twitter, Wordpress
I hate the Twitter Tools plugin. Twitter and traditional blogging are two different things. I don’t use Twitter as an aggregation of whenever my friends create new blog posts. I use an RSS reader for that.
What happens unfortunately is that I generally remove from my Twitter friends people that do that – as they generally have other annoying Twitter habits as well. :-)
/my soapbox
I hate the Twitter Tools plugin. Twitter and traditional blogging are two different things. I don't use Twitter as an aggregation of whenever my friends create new blog posts. I use an RSS reader for that.
What happens unfortunately is that I generally remove from my Twitter friends people that do that – as they generally have other annoying Twitter habits as well. :-)
/my soapbox
Aaron: I understand that a few people have a similar attitude. I’m still feeling this out to see what sort of attitude the majority of people have. I know several of my readers don’t use RSS at all.
If this blog gets to the point where I post multiple times a day, I’ll probably pull it or move it to it’s own dedicated twitter account. But as it stands now, I generally post every few days.
I find myself reposting a lot of things to twitter manually, as I want people’s opinions on things, and will especially be interested in them with the upcoming Macbook Pro posts. I know there are a number of people on Twitter that want to keep tabs on this, but may not want to subscribe for some reason (I know the body mod stuff makes some squeemish).
I wish Twitter did have some sort of filter for stuff like this. Like a “donttrack” feature that lets users weed out all twitter messages with certain words in them (i.e. “New blog post”).
Aaron: I understand that a few people have a similar attitude. I'm still feeling this out to see what sort of attitude the majority of people have. I know several of my readers don't use RSS at all.
If this blog gets to the point where I post multiple times a day, I'll probably pull it or move it to it's own dedicated twitter account. But as it stands now, I generally post every few days.
I find myself reposting a lot of things to twitter manually, as I want people's opinions on things, and will especially be interested in them with the upcoming Macbook Pro posts. I know there are a number of people on Twitter that want to keep tabs on this, but may not want to subscribe for some reason (I know the body mod stuff makes some squeemish).
I wish Twitter did have some sort of filter for stuff like this. Like a “donttrack” feature that lets users weed out all twitter messages with certain words in them (i.e. “New blog post”).
Took me awhile to read all the comments, but I really love the article. It proved to be very useful to me and I am sure to all the commenters here! It’s always nice
when you can not only be informed, but also entertained! I’m sure you had fun writing this article. Comfortably, the article is really the sweetest on this precious
topic.
http://youngbroadcasters.com/blogs/buytimberlandbootscheap/2011/04/29/coach-bags-oultet/
http://guccibagsdiscount5.blogciting.com/2011/04/29/coach-bags-oultet/
http://buddy.illifly.de/guccitote/2011/04/29/coach-bags-oultet/
http://blog.rakball.net/designerhandbags2/2011/04/29/coach-bags-oultet/
http://youngbroadcasters.com/blogs/timberlandclothes/2011/04/29/coach-bags-oultet/
http://youngbroadcasters.com/blogs/timberlandbootsformen/2011/04/29/coach-bags-oultet/
http://timberlandjacket.ofporn.org/2011/04/29/coach-bags-oultet/
http://timberlandshoesoutlet.smallkitchenreviews.com/coach-bags-oultet/
http://guccibagsonsale7.ionixe.com/2011/04/29/coach-bags-oultet/
http://blogs.indiatodayconclave.yourstagingsite.com/guccishoulderbags/?p=17