Videos not showing up on homepage

Front page Forums CodeCanyon products WordPress YouTube video post plugin Videos not showing up on homepage

This topic contains 9 replies, has 3 voices, and was last updated by  jnnynkdcelebs 3 years, 8 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #264

    jnnynkdcelebs
    Participant

    Constantin,

    Installed plugin, imported videos.. everything good. But when I tested it by publishing a video post it does not show up on my homepage. Any idea why? Unfortunately I cannot send you a link because our site is not live yet. Please help if you can. Thanks.

    Jen

    #265

    jnnynkdcelebs
    Participant

    Also, the theme we are using is WP Starter under WP Forge.

    #268

    depresantos
    Participant

    me the same

    #270

    Constantin
    Keymaster

    If you don’t want to make your theme compatible with the plugin, you could try to alter the query on your homepage to display the videos. To do this, try to add the following code into your WordPress theme functions.php file:

    /**
     * Add videos to homepage
     */
    function ccb_youtube_videos_homepage( $query ) {
    	// check that page isn't admin page, is homepage and the query
    	if ( !is_admin() && is_home() && $query->is_main_query() ){
    		// add video post type to query
    		$query->set( 'post_type', array( 'post', 'video' ) );
    	}
    	return $query;	
    }
    add_filter( 'pre_get_posts', 'ccb_youtube_videos_homepage' );
    
    #273

    jnnynkdcelebs
    Participant

    Constantin,

    Wow thank you this worked very well. Only now it’s showing on home page but without the video. It is only showing title of post and description of video. Any clue?

    Jen

    #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.

    #275

    jnnynkdcelebs
    Participant

    Constantin,

    Thank you so much, this worked for us as well. I have one more question.. on the post, the meta is missing (author, time stamp).. everything else is there (post title, comments etc). Is there a way to make the post meta show as well?

    Thanks again,

    Jen

    #281

    jnnynkdcelebs
    Participant

    Constantin,

    Just wondering if you were ever able to answer my previous Q from December 24th??

    Jen

    #289

    Constantin
    Keymaster

    Hi,

    Sorry for the delay, I will investigate this and make it happen on the next update. Unfortunaltely, I didn’t had the time to look into it but will do so.

    #310

    jnnynkdcelebs
    Participant

    Constantin,

    Hey just touching base to see if you found anything for the plugin as a fix to my problem with meta not showing up?

    Thanks,
    Jen

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.