Skip to content

Instantly share code, notes, and snippets.

@FranciscoHV
Created August 3, 2017 19:23
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 FranciscoHV/f868d5535acf37f88ebfb042b29920e0 to your computer and use it in GitHub Desktop.
Save FranciscoHV/f868d5535acf37f88ebfb042b29920e0 to your computer and use it in GitHub Desktop.
Custom.js and Style.css are not included in the website - Free Unit
function wplms_custom_course_curriculum_free_access_2($html,$lesson,$course_id){
$free=get_post_meta($lesson,'vibe_free',true);
if(vibe_validate($free))
$html ='<a href="'.get_permalink($lesson).'" class="ajax_unit">'.get_the_title($lesson).'</a>';
?>
<script>
jQuery(document).ready(function(){
jQuery('.ajax_unit').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
callbacks: {
parseAjax: function(mfpResponse) {
mfpResponse.data = jQuery(mfpResponse.data).find('.unit_wrap');
},
ajaxContentAdded: function() {
// jQuery('video,audio').mediaelementplayer();
jQuery('.fitvids').fitVids();
jQuery('.tip').tooltip();
jQuery('.nav-tabs li:first a').tab('show');
jQuery('.nav-tabs li a').click(function(event){
event.preventDefault();
jQuery(this).tab('show');
});
}
}
});
});
</script>
<style>.mfp-ajax-holder .mfp-content{max-width:720px;}</style>
<?php
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment