Created
January 29, 2013 16:10
-
-
Save sosukeinu/4665405 to your computer and use it in GitHub Desktop.
WP function category to post format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment