Skip to content

Instantly share code, notes, and snippets.

@jmdodd
Created December 31, 2011 21:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmdodd/1545420 to your computer and use it in GitHub Desktop.
Save jmdodd/1545420 to your computer and use it in GitHub Desktop.
Add post format to FeedWordPress syndicated posts
<?php
if ( ! function_exists( 'ucc_post_format_feedwordpress_syndicated_post' ) ) {
function ucc_post_format_feedwordpress_syndicated_post ( $data ) {
$feed = $data['meta']['syndication_feed'];
// Adjust stripos contents as needed.
if ( stripos( 'delicious.com', $feed ) !== false ) {
$data['tax_input']['post_format'] = 'post-format-link';
} elseif ( stripos( 'tumblr.com', $feed ) !== false ) {
$data['tax_input']['post_format'] = 'post-format-aside';
} elseif ( stripos( 'twitter.com', $feed ) !== false ) {
$data['tax_input']['post_format'] = 'post-format-status';
}
return $data;
} }
add_filter( 'syndicated_post' , 'ucc_post_format_feedwordpress_syndicated_post' );
/*
Copyright 2011 Jennifer M. Dodd (email: jmdodd@gmail.com)
Released under the GPLv2 (or later).
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment