Skip to content

Instantly share code, notes, and snippets.

@jcasabona
Last active June 16, 2020 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcasabona/6ac4cbfd226ed0dba32dcf0bb8ebb750 to your computer and use it in GitHub Desktop.
Save jcasabona/6ac4cbfd226ed0dba32dcf0bb8ebb750 to your computer and use it in GitHub Desktop.
Set LearnDash Video Controls to Visible
<?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