Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to setup my WordPress so that whenever I create a post with the category "Tweet", my wordpress installation automatically changes the post format from post to aside. This will help me because I want to use my wordpress for posting longer than 140 tweets to my twitter feed. The posting to twitter has been setup and it works.

The problem is that the Wordpress iOS app doesn't allow me to change the post format to Aside, so the only thing I can do is set the category of the post to "Tweet" and as soon as my wordpress receives it, it changes the post to aside.

I found the plugin "Set Aside" but it lets me change the post formats for all posts of a certain category that have already been posted, not the ones that I will post in the future.

Is this possible?

share|improve this question
    
I edited your question. I am assuming you mean post format not post type. –  Chris_O May 25 '12 at 3:27
    
Hey Chris, yes, I meant post format. I am not fully versed with the terminology... Just looking for answers :) –  Nitin Khanna May 25 '12 at 6:08

1 Answer 1

up vote 2 down vote accepted

Try putting this plugin in your wp-content/plugins folder and then activate it:

<?php

/*
Plugin Name: WPSE53245 - Set Tweet category posts as Aside
Plugin URI: http://http://wordpress.stackexchange.com/questions/53235
Description: Set Tweet category posts as Aside
Version: 0.1
Author: Ashfame
Author URI: http://wordpress.stackexchange.com/users/1521/ashfame
*/

    add_action( 'save_post', 'wpse53235_set_post_format_aside' );

    function wpse53235_set_post_format_aside( $postID ) {
        if ( has_post_format( 'aside', $postID ) || !has_term( 'tweet', 'category', $postID ) )
            return;
        set_post_format( $postID, 'aside' );
    }
share|improve this answer
    
Added return statement for conditional check not in 'tweet' category or if post format has already been set. –  Chris_O May 25 '12 at 7:03
    
Ashfame, thanks for the answer, but if you read my post properly, the reason why I'm asking specifically for a plugin is because I want to use the iOS wordpress app to post the aside. That will supersede the functions in the theme, will it not? I've written an explanatory post about my setup here -> blog.nitinkhanna.com/long-tweets-from-wordpress –  Nitin Khanna May 25 '12 at 7:24
    
@Chris_O Thanks! I forgot about the condition while posting the answer –  Ashfame May 25 '12 at 7:39
    
@NitinKhanna Did you try it? It should work. Because that app will use XMLRPC to publish the post on your WordPress, IMO. –  Ashfame May 25 '12 at 7:40
    
@Ashfame just one question before I try it... The category name that you've used is 'tweet' right? Because actually, the category name that I've used is LongTweet and it's slug is long-tweet. So I just need to replace the !has_term('tweet'...) with !has_term('LongTweet'...) right? –  Nitin Khanna May 25 '12 at 7:54

protected by Community Jan 27 at 21:03

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.