SHARE
TWEET

Untitled

Mizziness Jul 13th, 2016 (edited) 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function courses_shortcode($atts) {
  2.    
  3.     extract(shortcode_atts( array(
  4.         'limit' => 16,
  5.         'id' => array(592, 862, 418, 491, 1227, 1015, 847, 738, 541, 1186, 664, 695, 785), 
  6.     ), $atts ));
  7.    
  8.      if ( !is_array($id) ) {  
  9.         // then simultaneously parse it into an array and trim white space:
  10.         $id = array_map('trim', explode(', ', $id));
  11.     }
  12.    
  13.     $q_courses = new WP_Query( array(
  14.         'post_type' => array('course'),
  15.         'posts_per_page'  => $limit,
  16.         'post__in' => $id,
  17.         'orderby' => 'post__in',   
  18.     ));
  19.  
  20.     $video_courses = $q_courses->posts;
  21.     $list = "";
  22.    
  23.     if ($video_courses) {  
  24.         foreach($video_courses as $single_course1) {
  25.             $list .= '<article id="post-'.$single_course1->ID.'" class="all course-item col-md-3 col-xs-12">';    
  26.             $list .= do_shortcode( '[course_media course_id="'.$single_course1->ID.'"]' );
  27.             $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">';
  28.             $list .= do_shortcode( '[course_instructors course_id="'.$single_course1->ID.'" show_divider=no style=list-flat]' );
  29.             $list .= do_shortcode( '[ratings id="'.$single_course1->ID.'"]');
  30.             $list .=  do_shortcode( '[course_cost course_id="'.$single_course1->ID.'"]' );
  31.             $list .=  '<span class="buying-date-3-months">Nutzungslaufzeit: 12 Monate</span></div>';
  32.             $list .= '</article>';         
  33.         }
  34.     }
  35.  
  36.     return $list;
  37.     //return $id;
  38. }
  39. add_shortcode('video-kurse', 'courses_shortcode');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top