Created
August 1, 2017 16:33
-
-
Save leftlane/0e7514dc8b40861d4051ce170c8638bd to your computer and use it in GitHub Desktop.
Custom function to pull in the video on a lesson page on WP101.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lesson_get_video_tutorial() { | |
if ( 'lesson' === get_post_type() ) { | |
$lesson = new LLMS_Lesson( get_the_ID() ); | |
$display = false; | |
if ( $lesson->is_free() ) { | |
$display = true; | |
} else { | |
$display = llms_is_user_enrolled( get_current_user_id(), get_the_ID() ); | |
} | |
echo '<div class="wrap video-wrap">'; | |
if ( $display ) { | |
echo $lesson->get_video(); | |
} else { | |
echo '<a href="/membership/" title="Sign up to view this WordPress tutorial video"><img src="/wp-content/uploads/2014/03/non-member.jpg" alt="WordPress Tutorial: ' . the_title_attribute( array( 'echo' => 0 ) ) . '" width="1280" height="720" border="0" /></a>'; | |
} | |
echo '</div>'; | |
remove_action('lifterlms_single_lesson_before_summary', 'lifterlms_template_single_lesson_video', 20 ); | |
} | |
} | |
add_action( 'genesis_after_header', 'lesson_get_video_tutorial' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment