Reply To: Compatibility with VideoTube theme

#357

dystinkt
Participant

I also posted this on chat as I wasn’t sure if the forum was still active or not. Here’s some more information..I basically need the youtube url fed into the custom field vide_url

I have just spoken with the theme creator and this is his respone

The theme use “video” post type and “video_url” for custom field, it archive video link.

I have tried your tutorial and I can’t get it to work. Could you just respond with the changed code?

This is what I have so far:

/**
* Add theme compatibility
* @param array $themes - array of default compatible themes
*/
function wave_theme_compat( $themes ){

$themes['wave'] = array(
'post_type' => 'post',
'taxonomy' => false,
'post_meta' => array(
'embed' => 'video_embed_value'
),
'post_format' => 'video',
'theme_name' => 'Wave'
);

return $themes;
}
add_filter('cbc_youtube_theme_support', 'wave_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 wave_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;
}

$player_settings = cbc_get_player_settings();

// save the width as required by theme
update_post_meta( $post_id, 'video_width_value', $player_settings['width'] );
// flag post as video
update_post_meta($post_id, 'is_video_value', true);

// for short title, if needed, uncomment below
//update_post_meta($post_id, 'post_title_value', $video['title']);

// for short excerpt uncomment below
//update_post_meta($post_id, 'post_type_value', $video['description']);

}
add_action('cbc_post_insert', 'wave_post_fields', 10, 3);