Front page › Forums › CodeCanyon products › WordPress YouTube video post plugin › Help to make the plugin compatible › Reply To: Help to make the plugin compatible
January 22, 2015 at 7:58 PM
#403
Hi,
Please try this in your theme/child theme functions.php file, it should do the trick:
/** * Add theme compatibility * @param array $themes - array of default compatible themes */ function newspaper_theme_compat( $themes ){ $themes['newspaper'] = array( 'post_type' => 'post', 'taxonomy' => false, 'post_meta' => array(), 'post_format' => 'video', 'theme_name' => 'Newspaper' ); return $themes; } add_filter('cbc_youtube_theme_support', 'newspaper_theme_compat'); /** * On bulk post import, set up all extra fields needed by the theme to flag post as video * @param int $post_id - ID of newly created post * @param array $video - array of video data returned by YouTube * @param false/array $theme_import - theme import configuration */ function newspaper_post_fields( $post_id, $video, $theme_import ){ // check if setting is to import as theme post if( !$theme_import ){ return; } // look for the plugin general settings function if( !function_exists('cbc_get_player_settings') ){ return; } $url = 'http://www.youtube.com/watch?v='.$video['video_id']; $data = array( 'td_video' => $url ); update_post_meta( $post_id, 'td_post_video', $data ); } add_action('cbc_post_insert', 'newspaper_post_fields', 10, 3);