Reply To: Videos not showing up on homepage

#274

Constantin
Keymaster

Happy to hear this. To make videos visible, go to plugin Settings page and check the second option ( Allow videos in archive pages ).

You will also need to do a little modification in plugin file main.php. Open this file with any editor and locate function ccb_single_custom_post_filter() ( it’s the second function from this file ).

Next, right before the last if in function you need to enqueue the player JavaScript ( by default this is made to work only with video archive pages ).

Basically, the function will end up looking like this:

/**
 * Filter custom post content
 */
function ccb_single_custom_post_filter( $content ){
	
	$settings 	= cbc_get_settings();
	$is_visible = $settings['archives'] ? true : is_single();
	
	if( is_admin() || !$is_visible || !ccb_is_video_post() ){
		return $content;
	}
	
	global $post;
	$settings 	= ccb_get_video_settings( $post->ID, true );
	$video 		= get_post_meta($post->ID, '__cbc_video_data', true);
	
	$settings['video_id'] = $video['video_id'];
		
	$width = $settings['width'];
	$height = cbc_player_height( $settings['aspect_ratio'] , $width);
	
	// Filter - add extra CSS classes on single video container div element
	$class = apply_filters('ccb_video_post_css_class', array(), $post);
	$extra_css = implode(' ', $class);
	
	$video_container = '<div class="ccb_single_video_player '.$extra_css.'" '.cbc_data_attributes($settings).' style="width:'.$width.'px; height:'.$height.'px; max-width:100%;"><!-- player container --></div>';
	
	ccb_enqueue_player();
	
	if( 'below-content' == $settings['video_position'] ){
		return $content.$video_container;
	}else{
		return $video_container.$content;
	}	
}

This should do it. This modification will be made permanent or a suitable solution will be provided for it when the next update will be released.