Advertisement
Guest User

themeum-kidzy-class

a guest
Mar 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.60 KB | None | 0 0
  1. <?php
  2. add_shortcode( 'themeum_kidzy_class', 'themeum_kidzy_class_function');
  3.  
  4. function themeum_kidzy_class_function($atts, $content = null) {
  5.    
  6.     $heading        = '';
  7.     $class_category = '';
  8.     $count_post     = '';
  9.     $column         = '';
  10.     $class          = '';
  11.  
  12.     extract(shortcode_atts(array(
  13.         'heading'       => '',
  14.         'class_category'=> '',
  15.         'count_post'    =>  6,
  16.         'column'        => '',     
  17.         'class'         => '',
  18.         ), $atts));
  19.  
  20.  
  21.     global $wpdb;
  22.     global $post;
  23.  
  24.     $args = array(
  25.        'post_type'  => 'class',
  26.        'tax_query'  => array(
  27.                             array(
  28.                                 'taxonomy' => 'class_category',
  29.                                 'field'    => 'slug',
  30.                                 'terms'    => $class_category,
  31.                             ),
  32.                         ),     
  33.       'order'           => 'ASC',
  34.       'posts_per_page'  => esc_attr($count_post)
  35.     );
  36.  
  37.     $show_class = new WP_Query($args);
  38.  
  39.     $output = '';
  40.  
  41.     if ( $show_class->have_posts() ){
  42.         while($show_class->have_posts()) {
  43.             $show_class->the_post();
  44.  
  45.             $class_status = get_post_meta(get_the_ID(),'themeum_class_status',true);
  46.             $years_old = get_post_meta(get_the_ID(),'themeum_years_old',true);
  47.             $class_size = get_post_meta(get_the_ID(),'themeum_class_size',true);
  48.             $tution_fee = get_post_meta(get_the_ID(),'themeum_tution_fee',true);
  49.             $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'kidzy-blog-single' );       
  50.  
  51.  
  52.             $output .= '<div class="col-sm-4 col-xs-12">';
  53.                 $output .= '<div class="single-class">';
  54.  
  55.                 if($image){
  56.                     $output .= '<div class="class-img">';
  57.                         $output .= '<img class="img-responsive" src="'.esc_url( $image[0] ).'" alt="'.get_the_title().'">';
  58.                         $output .= '<div class="class-hover">';
  59.                             $output .= '<a href="'.get_the_permalink().'" class="popup"><i class="icon-link"></i></a>';
  60.                         $output .= '</div>';
  61.                     $output .= '</div>';
  62.                 }
  63.                
  64.                     $output .= '<div class="class-details">';
  65.                         $output .= '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
  66.                         $output .= '<p>'.$class_status.'</p>';
  67.                         $output .= '<div class="class_alias clearfix">';
  68.                             $output .= '<div class="class-meta pull-left">';
  69.                                 $output .= '<span>'.esc_html__('Years Old','themeum-core').'</span>';
  70.                                 $output .= '<p>'.$years_old.'</p>';
  71.                             $output .= '</div>';
  72.                             $output .= '<div class="class-meta pull-left">';
  73.                                 $output .= '<span>'.esc_html__('Class Size','themeum-core').'</span>';
  74.                                 $output .= '<p>'.$class_size.'</p>';
  75.                             $output .= '</div>';
  76.  
  77.                             // $output .= '<div class="class-meta pull-left">';
  78.                             //     $output .= '<span>'.esc_html__('Rate','themeum-core').'</span>';
  79.                             //     $output .= '<p>'.$tution_fee.'</p>';
  80.                             // $output .= '</div>';
  81.  
  82.                         $output .= '</div>';
  83.                     $output .= '</div>';
  84.                 $output .= '</div>';
  85.             $output .= '</div>';
  86.  
  87.         }//End of while
  88.     }//End of IF    
  89.  
  90.     return $output;
  91. }
  92.  
  93.  
  94. //Visual Composer
  95. if (class_exists('WPBakeryVisualComposerAbstract')) {
  96.     vc_map(array(
  97.         "name" => esc_html__("Display Classes", 'themeum-core'),
  98.         "base" => "themeum_kidzy_class",
  99.         'icon' => 'icon-thm-latest-news',
  100.         "class" => "",
  101.         "description" => esc_html__("All Class display by Category", 'themeum-core'),
  102.         "category" => esc_html__('Kidzy', 'themeum-core'),
  103.         "params" => array(
  104.  
  105.         array(
  106.             "type"      => "dropdown",
  107.             "heading"   => esc_html__("Category Filter", 'themeum-core'),
  108.             "param_name" => "class_category",
  109.             "value"     => themeum_cat_list('class_category'),
  110.         ),
  111.  
  112.         array(
  113.             "type"      => "textfield",
  114.             "heading"   => esc_html__("Number Of Post Show", "themeum-core"),
  115.             "param_name" => "count_post",
  116.             "value"     => "6",
  117.         ),        
  118.  
  119.         array(
  120.             "type"      => "dropdown",
  121.             "heading"   => esc_html__("Number Of Column", "themeum-core"),
  122.             "param_name" => "column",
  123.             "value"     => array('No Column'=>'','column 2'=>'6','column 3'=>'4','column 4'=>'3'),
  124.             ),                   
  125.  
  126.           array(
  127.             "type"      => "textfield",
  128.             "heading"   => esc_html__("Custom Class", "themeum-core"),
  129.             "param_name" => "class",
  130.             "value"     => "",
  131.             ),
  132.  
  133.             )
  134.  
  135.         ));
  136. }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement