Front page › Forums › CodeCanyon products › WordPress YouTube video post plugin › Videos not showing up on homepage
- This topic has 9 replies, 3 voices, and was last updated 8 years, 3 months ago by
jnnynkdcelebs.
-
AuthorPosts
-
December 17, 2013 at 8:21 PM #264
jnnynkdcelebs
ParticipantConstantin,
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
December 17, 2013 at 8:22 PM #265jnnynkdcelebs
ParticipantAlso, the theme we are using is WP Starter under WP Forge.
December 20, 2013 at 10:34 AM #268depresantos
Participantme the same
December 20, 2013 at 7:40 PM #270Constantin
KeymasterIf 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' );
December 20, 2013 at 11:14 PM #273jnnynkdcelebs
ParticipantConstantin,
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
December 21, 2013 at 11:27 AM #274Constantin
KeymasterHappy 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.
December 24, 2013 at 5:30 AM #275jnnynkdcelebs
ParticipantConstantin,
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
January 7, 2014 at 9:38 PM #281jnnynkdcelebs
ParticipantConstantin,
Just wondering if you were ever able to answer my previous Q from December 24th??
Jen
January 10, 2014 at 1:35 PM #289Constantin
KeymasterHi,
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.
January 30, 2014 at 10:07 PM #310jnnynkdcelebs
ParticipantConstantin,
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 -
AuthorPosts
- You must be logged in to reply to this topic.