Last active
July 7, 2018 17:00
-
-
Save MrVibe/fc417ed1e194ce373f0308e045d356d8 to your computer and use it in GitHub Desktop.
Embedding Watupro quiz in WPLMS units.
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
add_action('wp_footer',function(){ | |
?> | |
<script> | |
jQuery(document).ready(function($){ | |
if($('body').hasClass('page-template-start-php')){ | |
$('#watupro_quiz').each(function(){ | |
let unit_id = $('.unit_line.active .unit').attr('data-unit'); | |
$(this).next('form').append('<input type="hidden" name="no_ajax_course_id" value="'+$('#course_id').val()+'" /><input type="hidden" name="hash" value="'+$('#hash').val()+'" /><input type="hidden" name="load_unit" value="'+unit_id+'" />'); | |
}); | |
} | |
}); | |
</script> | |
<?php | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment