function rt_staff($atts, $content = null)
 {
     /**
      * Staff Posts	
      * @param  array $atts
      * @param  string $content
      * @return output
      */
     global $rt_item_width, $wp_query;
     //counter
     $counter = 1;
     //defaults
     extract(shortcode_atts(array("id" => 'staff-' . rand(100000, 1000000), "class" => "", "list_layout" => "1/1", "list_orderby" => "date", "list_order" => "DESC", "ids" => array()), $atts));
     //product id numbders
     $ids = !empty($ids) ? explode(",", trim($ids)) : array();
     //item width percentage
     $list_layout = !empty($list_layout) ? $list_layout : "1/3";
     $rt_item_width = $list_layout;
     //item width number
     $item_width_number = str_replace("1/", "", $list_layout);
     //row count
     $column_count = rt_column_count($list_layout);
     //general query
     $args = array('post_status' => 'publish', 'post_type' => 'staff', 'orderby' => $list_orderby, 'order' => $list_order, 'showposts' => 1000);
     if (!empty($ids)) {
         $args = array_merge($args, array('post__in' => $ids));
     }
     ob_start();
     $theQuery = query_posts($args);
     //column class
     $add_column_class = rt_column_class($list_layout);
     //get page & post counts
     $page_count = rt_get_page_count();
     $post_count = $page_count['post_count'];
     echo '<section id="' . $id . '" class="team border_grid clearfix ' . $class . ' ">';
     while (have_posts()) {
         the_post();
         //open row block
         if ($counter % $column_count == 1 || $column_count == 1) {
             echo '<div class="row clearfix">';
         }
         printf('<div class="col %s">' . "\n", $add_column_class);
         get_template_part('staff-contents/loop', 'content');
         echo '</div>' . "\n";
         //close row block
         if ($counter % $column_count == 0 || $post_count == $counter) {
             echo '</div>';
         }
         $counter++;
     }
     echo '</section>';
     //rt_get_pagination( $wp_query );
     wp_reset_query();
     $output_string = ob_get_contents();
     ob_end_clean();
     return $output_string;
 }
Esempio n. 2
0
    function rt_testimonial_carousel($atts, $content = null)
    {
        //[testimonial_carousel id="" heading="" heading_icon="" item_width="5" list_orderby="" list_order="" ids=""]
        //enqueue script files
        wp_enqueue_script('jquery-owl-carousel', RT_THEMEURI . '/js/owl.carousel.min.js', array(), "", false);
        //counter
        $counter = 1;
        //defaults
        extract(shortcode_atts(array("id" => 'testimonial-carousel-' . rand(100000, 1000000), "heading" => "", "heading_icon" => "", "max_item" => 100, "item_width" => 4, "list_orderby" => "date", "list_order" => "DESC", "ids" => array(), "style" => ""), $atts));
        //id numbders
        $ids = !empty($ids) ? explode(",", trim($ids)) : array();
        //layout name values
        $layout_values = array('', 'one', 'two', 'three', 'four', 'five');
        //general query
        $args = array('post_status' => 'publish', 'post_type' => 'testimonial', 'orderby' => $list_orderby, 'order' => $list_order, 'showposts' => $max_item);
        if (!empty($ids)) {
            $args = array_merge($args, array('post__in' => $ids));
        }
        ob_start();
        $theQuery = query_posts($args);
        //add class
        $add_class = "";
        //get page & post counts
        $page_count = rt_get_page_count();
        $post_count = $page_count['post_count'];
        //add holder class
        $add_holder_class = $style;
        $add_holder_class .= empty($heading) ? " without_heading" : " with_heading";
        echo '<div class="row clearfix">';
        echo !empty($heading) ? do_shortcode('[heading_bar heading="' . $heading . '" icon="' . $heading_icon . '" ]') : "";
        echo '<div id="' . $id . '" class="carousel-holder clearfix ' . $add_holder_class . ' " data-rt-animate="animate" data-rt-animation-type="fadeIn" data-rt-animation-group="single">';
        echo '<section class="carousel_items clearfix"><div class="owl-carousel">';
        while (have_posts()) {
            the_post();
            echo '<div class="testimonial item">' . "\n";
            //get content
            get_template_part('testimonial-contents/content');
            echo '</div>' . "\n";
            $counter++;
        }
        echo '</div></section></div></div>';
        //js script to run
        printf('
		<script type="text/javascript">
		 /* <![CDATA[ */ 
			// run carousel
				jQuery(document).ready(function() { 
					 jQuery("#%1$s").rt_start_carousels(%2$s,"%3$s");
				}); 
		/* ]]> */	
		</script>
	', $id, $item_width, $style);
        wp_reset_query();
        $output_string = ob_get_contents();
        ob_end_clean();
        return $output_string;
    }