*/
global $post;
$pt = $post->post_type;
+$ld_types = array('sfwd-courses','sfwd-lesses','sfwd-quiz');
$post_date = of_get_option('post_date');
$post_footer = of_get_option('post_footer');
$post_date_class = ((!empty($post_date) && $post_date == ' ') || has_post_thumbnail()) ? " no-date" : "";
<img src="<?php echo esc_url($image[0]); ?>" alt="<?php echo esc_attr(get_the_title()); ?>">
</div>
<?php endif;
- $class = ($pt === 'cmvl_channel') ? 'cmvl-title' : "basic-title";
+ $class = ($pt === 'sfwd-courses') ? 'cmvl-title' : "basic-title";
?>
<h1 class="entry-title<?php echo esc_attr($post_date_class); ?> <?php echo $class; ?>"><?php the_title(); ?></h1>
- <?php if( $pt !== 'cmvl_channel'){ ?>
+ <?php if( !in_array($pt, $ld_types) ){ ?>
<div class="entry-meta">
<?php accesspress_parallax_posted_on(); ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
- <?php if( $pt === 'cmvl_channel'){ ?>
+ <?php if( $pt === 'sfwd-courses'){ ?>
<p> <?php echo $lesson_content; ?> </p>
<?php } ?>
<?php the_content(); ?>
<div id="go-top"><a href="#page"><i class="fa fa-angle-up"></i></a></div>
<?php wp_footer(); ?>
+<div class="glm-badge-alert" id="quiz-badge">
+ <div style="position: relative;background: #3D3D3D;" id="glm-quiz-passed">
+ <img style="float: left;" src="<?php echo get_template_directory_uri(); ?>/assets/badge.png" alt="" />
+ <span> You've passed the quiz </span>
+ <div style="clear: both;"> </div>
+ </div>
+ </div>
+ <div class="glm-badge-alert" id="course-badge">
+ <div style="position: relative;background: #3D3D3D;" id="glm-course-passed">
+ <img style="float: left;" src="<?php echo get_template_directory_uri(); ?>/assets/badge.png" alt="" />
+ <span> You've passed the quiz </span>
+ <div style="clear: both;"> </div>
+ </div>
+ </div>
+ <script>
+ (function(open) {
+ const $ = jQuery;
+ XMLHttpRequest.prototype.open = function() {
+ this.addEventListener("readystatechange", function() {
+ if( this.response.includes('quiz_finished') && this.readyState === 4 ){
+ let data = JSON.parse(this.response);
+ if(data.pass === 1){
+ setTimeout(function(){
+ $(".glm-badge-alert#quiz-badge").fadeIn("fast");
+ $(".glm-badge-alert#quiz-badge").addClass("shake");
+ }, 1500)
+ setTimeout(function(){
+ $(".glm-badge-alert#quiz-badge").fadeOut("slow");
+ }, 10000)
+ }
+ }
+ if( this.response.includes('course_finished') && this.readyState === 4 ){
+ let data = JSON.parse(this.response);
+ if(data.pass === 1){
+ setTimeout(function(){
+ $(".glm-badge-alert#course-badge").fadeIn("fast");
+ $(".glm-badge-alert#course-badge").addClass("shake");
+ }, 1500)
+ setTimeout(function(){
+ $(".glm-badge-alert#course-badge").fadeOut("slow");
+ }, 10000)
+ }
+ }
+ }, false);
+ open.apply(this, arguments);
+ };
+ })(XMLHttpRequest.prototype.open);
</body>
</html>
\ No newline at end of file
return date('l, F t, Y');
}
add_shortcode( 'date', 'displaydate' );
-add_filter( 'show_admin_bar', '__return_false' );
\ No newline at end of file
+add_filter( 'show_admin_bar', '__return_false' );
+add_action("learndash_quiz_completed", function($data) {
+ $data["quiz_finished"] = "yes";
+ echo json_encode($data);
+ wp_die();
+}, 5, 1);
+add_action("learndash_course_completed", function($data) {
+ $finished["quiz_finished"] = "yes";
+ echo json_encode($finished);
+ wp_die();
+}, 5, 1);
\ No newline at end of file
--- /dev/null
+body{
+ .glm-badge-alert#quiz-badge{
+ &:hover{
+ cursor: pointer;
+ }
+ display: none;
+ width: 300px;
+ position: absolute;
+ top: 25px;
+ right: 10px;
+ z-index: 999;
+ img{
+ max-width: 75px;
+ }
+ span{
+ font-size: 18px;
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ color:white;
+ left: 90px;
+ }
+ img:hover {
+ /* Start the shake animation and make the animation last for 0.5 seconds */
+ animation: shake 0.5s;
+ /* When the animation is finished, start again */
+ animation-iteration-count: infinite;
+ }
+
+ @keyframes shake {
+ 10%, 90% {
+ transform: translate3d(-2px, 0, 0);
+ }
+
+ 20%, 80% {
+ transform: translate3d(3px, 0, 0);
+ }
+
+ 30%, 50%, 70% {
+ transform: translate3d(-5px, 0, 0);
+ }
+
+ 40%, 60% {
+ transform: translate3d(5px, 0, 0);
+ }
+ }
+ }
+}
+.shake{
+ animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
+}
\ No newline at end of file
@import 'video-lessons';
@import 'body';
+@import 'badge';
*/
global $post;
$pt = $post->post_type;
-if($pt === 'cmvl_channel'){
+$title = $post->post_name;
+$ld_types = array('sfwd-courses','sfwd-lessons','sfwd-quiz');
+if(in_array($pt, $ld_types)){
$fw = 'full-width';
}else {
$fw = false;
get_header(); ?>
<div class="mid-content clearfix">
<div id="primary" class="content-area <?php echo $fw; ?>">
- <?php if($pt === 'cmvl_channel'){ ?>
- <a href="<?php echo get_permalink(363); ?>">Back to my courses</a>
- <?php } ?>
-
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' );
-
- if($pt !== 'cmvl_channel'){
+
+ if(!in_array($pt, $ld_types)){
+
$post_pagination = of_get_option('post_pagination');
if( $post_pagination == 1 || !isset($post_pagination)) :
the_post_navigation( array(
</div><!-- #primary -->
<?php
- if($pt !== "cmvl_channel"){
+ if(!in_array($pt, $ld_types)){
get_sidebar();
}
?>