Last active
June 16, 2020 19:19
-
-
Save jcasabona/6ac4cbfd226ed0dba32dcf0bb8ebb750 to your computer and use it in GitHub Desktop.
Set LearnDash Video Controls to Visible
This file contains hidden or 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
<?php | |
//For setting all LD videos to controls on. | |
function jc_set_video_controls() { | |
$lessons = new WP_Query( | |
array( | |
'post_type' => array( 'sfwd-lessons', 'sfwd-topic' ), | |
'posts_per_page' => -1, | |
) | |
); | |
if ( $lessons->have_posts() ) { | |
while ( $lessons->have_posts() ) { | |
$lessons->the_post(); | |
learndash_update_setting( get_the_ID(), 'lesson_video_show_controls', true ); | |
} | |
} | |
} | |
register_activation_hook( __FILE__, 'jc_swap_videos' ); | |
// For Setting the option on post save | |
function jc_set_video_controls_on( $post_id ) { | |
learndash_update_setting( $post_id, 'lesson_video_show_controls', true ); | |
} | |
add_action( 'save_post', 'jc_set_video_controls_on' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment