dd
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
1 changed file
with
48 additions
and
0 deletions
| ... | @@ -71,3 +71,51 @@ function the_bread() { | ... | @@ -71,3 +71,51 @@ function the_bread() { |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | }; | 73 | }; |
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | add_shortcode( 'certs', 'certs' ); | ||
| 78 | |||
| 79 | function certs(){ | ||
| 80 | |||
| 81 | try{ | ||
| 82 | $enrolled_courses = learndash_user_get_enrolled_courses( get_current_user_id(), array(), false); | ||
| 83 | |||
| 84 | |||
| 85 | ob_start(); | ||
| 86 | |||
| 87 | if (is_array($enrolled_courses)):?> | ||
| 88 | |||
| 89 | <div class="carousel"> | ||
| 90 | <div id="cert" class="cert-carousel carousel-items container"> | ||
| 91 | <div class='swiper-wrapper'> | ||
| 92 | <?php foreach($enrolled_courses as $enrolled_course){ | ||
| 93 | $cert = learndash_get_course_certificate_link($enrolled_course, get_current_user_id()); | ||
| 94 | if(!empty($cert)){ | ||
| 95 | $sfwd_course = get_post_meta($enrolled_course , '_sfwd-courses', true ); | ||
| 96 | $thumbnail_id = "911"; ?> | ||
| 97 | <div class="swiper-slide"> | ||
| 98 | <div class="cert"> | ||
| 99 | <?php echo '<a target="_blank" style="background-image:url('.wp_get_attachment_url( $thumbnail_id).')" class="cert_link" href="'.$cert.'">'. wp_get_attachment_image($thumbnail_id,'medium' ).'<div class="cert-text"><p><strong>' | ||
| 100 | .get_user_meta(get_current_user_id(), 'first_name', true )." ". get_user_meta(get_current_user_id(), 'last_name', true ).'</strong></p>' | ||
| 101 | .get_the_title( $enrolled_course ).'</div></a>'; | ||
| 102 | ?> | ||
| 103 | </div> | ||
| 104 | </div> | ||
| 105 | <?php } | ||
| 106 | }; ?> | ||
| 107 | </div> | ||
| 108 | <div class="swiper-pagination"></div> | ||
| 109 | <div class="swiper-button-prev" data-id="cert"></div> | ||
| 110 | <div class="swiper-button-next" data-id="cert"></div> | ||
| 111 | </div> | ||
| 112 | </div> | ||
| 113 | |||
| 114 | <?php endif; | ||
| 115 | wp_reset_query(); | ||
| 116 | $output = ob_get_clean(); | ||
| 117 | return $output; | ||
| 118 | }catch(Throwable $e) { | ||
| 119 | error_log("certs()". $e->getMessage()) ; | ||
| 120 | } | ||
| 121 | } | ... | ... |
-
Please register or sign in to post a comment