Editing "Twitter Tools" to add default category IF none is set
This is what I want to do:
- Post a cameraphone image from iPhone to Flickr using Flickr’s email2blog function.
- Flickr receives photo, updates my Flickr page, then packages it to be sent to my WordPress install.
- WordPress install receives data from Flickr, including title, layout, description, links, and posts it.
- WordPress, via Twitter Tools, posts the title as the tweet text, add a shortened link, and prefix it with the post’s category.
Format: “CATEGORY – Title as tweet text. hxxp://shorten.ed”
I have managed to make it work for posts I create myself, but the category bit is not working for posts received from Flickr.
I am getting: ” – Title as tweet text. hxxp://shorten.ed”
Below was what I edited (well, there are more, but this is the main bit).
$categories = apply_filters('tweet_blog_post_category', get_the_category());
$category = $categories;
$cats = $category->cat_name;
$tweet->tw_text = sprintf(__($this->tweet_format, 'twitter-tools'), strtoupper($cats.' - '), @html_entity_decode($post->post_title, ENT_COMPAT, 'UTF-8'), $url);
I suspect that the problem lies in the fact that Flickr does not set the category for posts it sends to WordPress. So when it gets posted by Flickr (through XML-RPC), the post does not have a category at all, not even the default one.
Ideally, I want something that is an if-then statement with the filter of “tweet_blog_post_category.” That is “If there is no category set, go back and set category as cat_name.” Am I using add_category?
Any plugin wizards out there?
- The topic ‘Editing "Twitter Tools" to add default category IF none is set’ is closed to new replies.