Skip to content

Instantly share code, notes, and snippets.

@sosukeinu
Created January 29, 2013 16:10
Show Gist options
  • Save sosukeinu/4665405 to your computer and use it in GitHub Desktop.
Save sosukeinu/4665405 to your computer and use it in GitHub Desktop.
WP function category to post format
<?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