Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Get reviews of course
- This topic has 3 replies, 2 voices, and was last updated 5 years, 7 months ago by logan.
-
AuthorPosts
-
April 2, 2019 at 3:59 pm #202957gsjaakSpectatorHi, Is there a way to query the reviews that are given on courses? It would be so nice if we could make a carousel out of these reviews or in some way to get the reviews of all courses to be shown else where in the site. Maybe even store reviews as testimonials, or something. This would be great! Any idea how to make this possible? Kind regardsApril 3, 2019 at 12:22 pm #203076loganMemberHello, This was a custom feature request but you are our valuable customer, and we have written it for you. Please add this code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('course_review',function ($atts,$content=null){
$comments = get_comments( array( 'post_id' => $atts['course']) );
if(!empty($comments)){
$return .= '<ul class="course_reviews_list">';
foreach ( $comments as $comment ) :
$comment_title = get_comment_meta($comment->comment_ID,'review_title',true);
$comment_rating = get_comment_meta($comment->comment_ID,'review_rating',true);
$comment_content = $comment->comment_content;
$return .= '<li>
<span class="bp_core_get_userlink avatar">'.bp_core_fetch_avatar ( array( 'item_id' => $comment->user_id, 'type' => 'thumb' ) ).'</span>
<span class="comment_title">'.$comment_title.'</span>
<span class="comment_rating">'.bp_course_display_rating($comment_rating).'</span>
<span class="comment_content">'.$comment_content.'</span>
<span class="bp_core_get_userlink">'.bp_core_get_userlink($comment->user_id).'</span>
</li>';
endforeach;
$return .= '</ul>';
$return .= '<style>
ul.course_reviews_list li{
width:300px;
display:grid;
grid-template-columns:50px 1fr;
grid-template-rows:1fr 1fr 1fr 1fr;
grid-gap:5px;
}
ul.course_reviews_list li .bp_core_get_userlink.avatar{grid-row: 1/-1;}
ul.course_reviews_list li .bp_core_get_userlink img{
width:48px;
height:48px;
border-radius:50%;
grid-template-column:1/-1;
}
</style><script type="text/javascript" charset="utf-8">
$(window).load(function() {
$(".course_reviews_list").flexslider();
});
</script>';
}
return $return;
});
Refer: http://prntscr.com/n6wg56 http://prntscr.com/n6wglv G'day.April 8, 2019 at 4:48 pm #203731gsjaakSpectatorAmazing thank you very much! Have a great day :)!April 9, 2019 at 10:06 am #203817loganMemberDear Friend, That’s great! Glad you’re enjoying the theme – thanks for using it! 🙂 If I can be of assistance, please do not hesitate to contact me again. Closing this topic. Best regards:) -
AuthorPosts
- The topic ‘Get reviews of course’ is closed to new replies.