Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function courses_shortcode($atts) {
- extract(shortcode_atts( array(
- 'limit' => 16,
- 'id' => array(592, 862, 418, 491, 1227, 1015, 847, 738, 541, 1186, 664, 695, 785),
- ), $atts ));
- if ( !is_array($id) ) {
- // then simultaneously parse it into an array and trim white space:
- $id = array_map('trim', explode(', ', $id));
- }
- $q_courses = new WP_Query( array(
- 'post_type' => array('course'),
- 'posts_per_page' => $limit,
- 'post__in' => $id,
- 'orderby' => 'post__in',
- ));
- $video_courses = $q_courses->posts;
- $list = "";
- if ($video_courses) {
- foreach($video_courses as $single_course1) {
- $list .= '<article id="post-'.$single_course1->ID.'" class="all course-item col-md-3 col-xs-12">';
- $list .= do_shortcode( '[course_media course_id="'.$single_course1->ID.'"]' );
- $list .= '<h3 class="course-title"><a href="'.get_the_permalink($single_course1->ID).'">'.get_the_title($single_course1->ID).'</a></h3><div class="entry-content">';
- $list .= do_shortcode( '[course_instructors course_id="'.$single_course1->ID.'" show_divider=no style=list-flat]' );
- $list .= do_shortcode( '[ratings id="'.$single_course1->ID.'"]');
- $list .= do_shortcode( '[course_cost course_id="'.$single_course1->ID.'"]' );
- $list .= '<span class="buying-date-3-months">Nutzungslaufzeit: 12 Monate</span></div>';
- $list .= '</article>';
- }
- }
- return $list;
- //return $id;
- }
- add_shortcode('video-kurse', 'courses_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement