• Resolved sterndesign

    (@sterndesign)


    Hi there,

    We’ve got a large number of vimeo videos added to our lessons via the Video Embed Code Box. Here’s an example:

    <iframe src="https://player.vimeo.com/video/169260237" width="640" height="480" frameborder="0" allowfullscreen></iframe>

    When we switched to the new Learning Mode, these videos no longer show up.

    I tried adding this snippet from another thread, to output the video content, but it did not work.

    function sensei_snippet_add_lesson_video_to_content( $content ) {
    
    	if ( is_admin() || ! is_single() || 'lesson' !== get_post_type() || ! Sensei_Course_Theme::instance()->is_active() ) {
    		return $content;
    	}
    
    	remove_filter( 'the_content', 'sensei_snippet_add_lesson_video_to_content', 80 );
    
    	ob_start();
    	Sensei()->frontend->sensei_lesson_video( get_the_ID() );
    	$video = ob_get_clean();
    
    	// Change to ' return $content . $video; ' to place video at the bottom.
    	return $video . $content;
    }

    Any ideas on how to make this work? We’re using Generate Press theme, and Theme Styles are Disabled. I know we could manually add the videos via blocks, but would prefer not to have to!

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @sterndesign,

    Just want to make sure you’ve also added this line:

    add_filter( 'the_content', 'sensei_snippet_add_lesson_video_to_content', 80, 1 );

    So the whole snippet is:

    function sensei_snippet_add_lesson_video_to_content( $content ) {
    
    	if ( is_admin() || ! is_single() || 'lesson' !== get_post_type() || ! Sensei_Course_Theme::instance()->is_active() ) {
    		return $content;
    	}
    
    	remove_filter( 'the_content', 'sensei_snippet_add_lesson_video_to_content', 80 );
    
    	ob_start();
    	Sensei()->frontend->sensei_lesson_video( get_the_ID() );
    	$video = ob_get_clean();
    
    	// Change to ' return $content . $video; ' to place video at the bottom.
    	return $video . $content;
    }
    
    add_filter( 'the_content', 'sensei_snippet_add_lesson_video_to_content', 80, 1 );

    Let us know how it goes.

    Thread Starter sterndesign

    (@sterndesign)

    Ahh, that did the trick, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Embed Video Code Not Showing Video’ is closed to new replies.