" rel="bookmark"><?php the_title(); ?> </a> </div><!-- / end div .post-title-holder --> <?php $the_excerpt = rt_search_highlight(trim(get_search_query()), get_the_excerpt()); echo $the_excerpt; ?> </article> <?php } rt_get_pagination($wp_query); wp_reset_query(); } else { ?> <?php get_template_part('content', 'none'); ?> <?php } ?> </div> </section><!-- / end section .content --> <?php get_sidebar(); ?>
function rt_staff($atts, $content = null) { //[staff_box id="" item_width="5" list_orderby="" list_order="" ids="" style=""] global $rt_item_width, $wp_query; //counter $counter = 1; //defaults extract(shortcode_atts(array("id" => 'staff-' . rand(100000, 1000000), "item_width" => 4, "list_orderby" => "date", "list_order" => "DESC", "ids" => array(), "style" => ""), $atts)); //product id numbders $ids = !empty($ids) ? explode(",", trim($ids)) : array(); //item width $item_width = !empty($item_width) ? $item_width : 4; //global values for posts $rt_item_width = $item_width; //layout name values $layout_values = array('', 'one', 'two', 'three', 'four', 'five'); //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); //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; echo '<section id="' . $id . '" class="team clearfix ' . $add_holder_class . ' " data-rt-animation-group="group">'; while (have_posts()) { the_post(); //add first last classes if filterable is off $add_class = ""; if ($counter % $item_width == 1 || $item_width == 1) { $add_class .= " first"; } if (($counter % $item_width == 0 || $post_count == $counter) && $add_class == "") { $add_class .= " last"; } //open row block if ($counter % $item_width == 1 || $item_width == 1) { echo '<div class="row clearfix">'; } printf('<div class="person box %s %s" data-rt-animate="animate" data-rt-animation-type="fadeInDown">' . "\n", $layout_values[$item_width], $add_class); get_template_part('staff-contents/content'); echo '</div>' . "\n"; //close row block and add hr if ($counter % $item_width == 0 || $post_count == $counter) { echo '</div>'; } if ($counter % $item_width == 0 && $post_count != $counter) { echo '<hr class="style-four">'; } $counter++; } echo '</section>'; rt_get_pagination($wp_query); wp_reset_query(); $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function rt_blog_post_loop($wp_query = false, $list_layout = "one", $archive = false) { global $more, $rt_list_style, $rt_global_post_values, $rt_pagination; //counter $counter = 1; //get the list style of the post $rt_list_style = isset($rt_list_style) ? $rt_list_style : get_option(RT_THEMESLUG . '_blog_list_style'); //layout name values $layout_values = array('one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5); //item width $item_width = $layout_values[$list_layout]; //add_class $add_class = $item_width > 1 ? "small_box" : ""; if ($wp_query->have_posts()) { while ($wp_query->have_posts()) { $wp_query->the_post(); //get global post values $rt_global_post_values = rt_get_global_post_values($wp_query->post, $item_width); //more splitter 0 = split content with more tag, 1 = ignore more tag $more = 0; if ($counter % $layout_values[$list_layout] == 1 || $layout_values[$list_layout] == 1) { echo '<div class="row">'; } printf('<div class="box %s %s" data-rt-animate="animate" data-rt-animation-type="fadeIn" data-rt-animation-group="single">' . "\n", $list_layout, $add_class); add_filter("the_content", "remove_blog_shortcode", 10); if ($archive) { get_template_part('/post-contents/archive', 'content'); } else { get_template_part('/post-contents/content', get_post_format()); } echo '</div>' . "\n"; if ($counter % $layout_values[$list_layout] == 0 || $wp_query->post_count == $counter) { echo '</div>'; } $counter++; } if ($rt_pagination) { rt_get_pagination($wp_query); } } }
/** * Product Loop * @param array $wp_query * @param array $atts * @return output */ function rt_product_post_loop($wp_query = array(), $atts = array()) { global $rt_product_post_values, $rt_product_list_atts; //sanitize fields $atts["id"] = isset($atts["id"]) ? sanitize_html_class($atts["id"]) : 'product-dynamicID-' . rand(100000, 1000000); //defaults $rt_product_list_atts = shortcode_atts(array("id" => 'product-dynamicID-' . rand(100000, 1000000), "list_layout" => get_theme_mod(RT_THEMESLUG . '_product_layout'), "layout_style" => get_theme_mod(RT_THEMESLUG . '_product_layout_style'), "pagination" => "true", "ajax_pagination" => "false", "featured_image_resize" => get_theme_mod(RT_THEMESLUG . "_product_image_resize"), "featured_image_max_width" => get_theme_mod(RT_THEMESLUG . "_product_image_width"), "featured_image_max_height" => get_theme_mod(RT_THEMESLUG . "_product_image_height"), "featured_image_crop" => get_theme_mod(RT_THEMESLUG . "_product_image_crop"), "list_orderby" => "date", "list_order" => "DESC", "item_per_page" => 10, "categories" => "", "ajax" => "false", "paged" => 0, "wpml_lang" => "", "display_descriptions" => "true", "display_titles" => "true", "display_price" => get_theme_mod(RT_THEMESLUG . "_show_price_in_list"), "ids" => ""), $atts); extract($rt_product_list_atts); $wp_reset_postdata = false; //counter $counter = 1; //custom query if (!$wp_query) { //paged if ($pagination !== "false" && $paged == 0) { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } } //create a post status array $post_status = is_user_logged_in() ? array('private', 'publish') : "publish"; //general query $args = array('post_status' => $post_status, 'post_type' => 'products', 'orderby' => $list_orderby, 'order' => $list_order, 'posts_per_page' => $item_per_page, 'paged' => $paged); if (!empty($ids)) { $ids = !empty($ids) ? explode(",", trim($ids)) : array(); $args = array_merge($args, array('post__in' => $ids)); } if (!empty($categories)) { $categories = is_array($categories) ? $categories : explode(",", rt_wpml_lang_object_ids($categories, "product_categories", $wpml_lang)); $args = array_merge($args, array('tax_query' => array(array('taxonomy' => 'product_categories', 'field' => 'id', 'terms' => $categories, 'operator' => "IN")))); } $wp_query = new WP_Query($args); $wp_reset_postdata = true; } //get page & post counts $post_count = $wp_query->post_count; $page_count = $wp_query->max_num_pages; //item width percentage $list_layout = !empty($list_layout) ? $list_layout : "1/3"; //layout style $add_holder_class = $list_layout == "1/1" ? "" : ($layout_style == "grid" ? " border_grid fixed_heights" : " masonry"); //column class $add_column_class = "product_item_holder "; $add_column_class .= rt_column_class($list_layout); $add_column_class .= $layout_style == "masonry" ? " isotope-item" : ""; //column count $column_count = rt_column_count($list_layout); if ($wp_query->have_posts()) { //open the wrapper echo "\n" . '<div id="' . $id . '" class="product_holder product-showcase clearfix ' . $add_holder_class . '" data-column-width="' . $column_count . '" itemscope itemtype="http://schema.org/Product">' . "\n"; //the loop while ($wp_query->have_posts()) { $wp_query->the_post(); //get post values $rt_product_post_values = rt_get_product_loop_post_values($wp_query->post, $rt_product_list_atts); //selected term list of each post $term_list = get_the_terms($wp_query->post->ID, 'product_categories'); //add terms as class name $addTermsClass = ""; if ($term_list) { if (is_array($term_list)) { foreach ($term_list as $termSlug) { $addTermsClass .= " " . $termSlug->slug; } } } //open row block if ($layout_style != "masonry" && $list_layout != "1/1" && ($counter % $column_count == 1 || $column_count == 1)) { echo '<div class="row clearfix">' . "\n"; } echo $list_layout != "1/1" ? '<div class="col ' . $add_column_class . ' ' . $addTermsClass . '">' . "\n" : ""; get_template_part('product-contents/loop', 'content'); echo $list_layout != "1/1" ? '</div>' . "\n" : ""; //close row block if ($layout_style != "masonry" && $list_layout != "1/1" && ($counter % $column_count == 0 || $post_count == $counter)) { echo '</div>' . "\n"; } $counter++; } //close wrapper echo '</div>' . "\n"; if ($pagination !== "false" && $ajax_pagination === "false" || $pagination !== "false" && $layout_style != "masonry") { rt_get_pagination($wp_query); } if ($ajax_pagination !== "false" && $layout_style == "masonry" && $page_count > 1 && $ajax === "false") { $rt_product_list_atts["purpose"] = "products"; rt_get_ajax_loader_button($rt_product_list_atts, $page_count); } } //reset post data for the new query if ($wp_reset_postdata) { wp_reset_postdata(); } }
function rt_woocommerce_pagination() { global $wp_query; if ($wp_query->max_num_pages > 1) { rt_get_pagination($wp_query); } }
/** * Woo Products * @param array $wp_query * @param array $atts * @return output */ function rt_woo_products($atts = array()) { //sanitize fields $atts["id"] = isset($atts["id"]) ? sanitize_html_class($atts["id"]) : 'product-dynamicID-' . rand(100000, 1000000); //defaults $rt_product_list_atts = shortcode_atts(array("id" => 'product-dynamicID-' . rand(100000, 1000000), "list_layout" => "1/3", "pagination" => "true", "list_orderby" => "date", "list_order" => "DESC", "item_per_page" => 10, "categories" => "", "paged" => 0, "ids" => ""), $atts); extract($rt_product_list_atts); //counter $counter = 1; //paged if ($pagination && $paged == 0) { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } } //create a post status array $post_status = is_user_logged_in() ? array('private', 'publish') : "publish"; //general query $args = array('post_status' => $post_status, 'post_type' => 'product', 'orderby' => $list_orderby, 'order' => $list_order, 'posts_per_page' => $item_per_page, 'ignore_sticky_posts' => 1, 'paged' => $paged, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'))); if (!empty($ids)) { $ids = !empty($ids) ? explode(",", trim($ids)) : array(); $args = array_merge($args, array('post__in' => $ids)); } if (!empty($categories)) { $categories = is_array($categories) ? $categories : explode(",", rt_wpml_lang_object_ids($categories, "product_cat")); $args = array_merge($args, array('tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $categories, 'operator' => "IN")))); } $wp_query = new WP_Query($args); //get page & post counts $post_count = $wp_query->post_count; $page_count = $wp_query->max_num_pages; //item width percentage $list_layout = !empty($list_layout) ? $list_layout : "1/3"; //layout style $add_holder_class = $list_layout == "1/1" ? "" : " border_grid fixed_heights"; //column class $add_column_class = "product_item_holder "; $add_column_class .= rt_column_class($list_layout); //column count $column_count = rt_column_count($list_layout); //output $output = ""; if ($wp_query->have_posts()) { //open the wrapper $output .= "\n" . '<div id="' . $id . '" class="woocommerce product_holder product-showcase clearfix ' . $add_holder_class . '" data-column-width="' . $column_count . '" itemscope itemtype="http://schema.org/Product">' . "\n"; //the loop while ($wp_query->have_posts()) { $wp_query->the_post(); //open row block if ($list_layout != "1/1" && ($counter % $column_count == 1 || $column_count == 1)) { $output .= '<div class="row clearfix">' . "\n"; } $output .= $list_layout != "1/1" ? '<div class="col ' . $add_column_class . '">' . "\n" : ""; ob_start(); get_template_part('woocommerce/shortcode-content', 'product'); $output .= ob_get_contents(); ob_end_clean(); $output .= $list_layout != "1/1" ? '</div>' . "\n" : ""; //close row block if ($list_layout != "1/1" && ($counter % $column_count == 0 || $post_count == $counter)) { $output .= '</div>' . "\n"; } $counter++; } //reset post data for the new query wp_reset_postdata(); //close wrapper $output .= '</div>' . "\n"; if ($pagination !== "false") { $output .= rt_get_pagination($wp_query, 8, false, false, false); } return $output; } }
function rt_testimonials($atts, $content = null) { //[testimonial_box id="" item_width="5" list_orderby="" list_order="" ids=""] global $paged; //counter $counter = 1; //defaults extract(shortcode_atts(array("id" => 'testimonial-' . rand(100000, 1000000), "item_width" => 4, "ids" => array(), "style" => "", "item_per_page" => 9, "list_orderby" => "date", "list_order" => "DESC", "pagination" => ""), $atts)); //product id numbders $ids = !empty($ids) ? explode(",", trim($ids)) : array(); //item width $item_width = !empty($item_width) ? $item_width : 4; //layout name values $layout_values = array('', 'one', 'two', 'three', 'four', 'five'); //pagination $pagination = $pagination == "false" ? false : $pagination; //paged if ($pagination) { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } } else { $paged = 0; } //create a post status array $post_status = is_user_logged_in() ? array('private', 'publish') : "publish"; //general query $args = array('post_status' => $post_status, 'post_type' => 'testimonial', 'orderby' => $list_orderby, 'order' => $list_order, 'posts_per_page' => $item_per_page, 'paged' => $paged); if (!empty($ids)) { $args = array_merge($args, array('post__in' => $ids)); } ob_start(); $theQuery = new WP_Query($args); //add class $add_class = ""; //get page & post counts $post_count = $theQuery->post_count; //add holder class $add_holder_class = " " . $style; echo '<section id="' . $id . '" class="testimonials clearfix ' . $add_holder_class . ' " data-rt-animation-group="group">'; while ($theQuery->have_posts()) { $theQuery->the_post(); //add first last classes if filterable is off $add_class = ""; if ($counter % $item_width == 1 || $item_width == 1) { $add_class .= " first"; } if (($counter % $item_width == 0 || $post_count == $counter) && $add_class == "") { $add_class .= " last"; } //open row block if ($counter % $item_width == 1 || $item_width == 1) { echo '<div class="row clearfix">'; } printf('<div class="testimonial box %s %s" data-rt-animate="animate" data-rt-animation-type="fadeIn">' . "\n", $layout_values[$item_width], $add_class); get_template_part('testimonial-contents/content'); echo '</div>' . "\n"; //close row block and add hr if ($counter % $item_width == 0 || $post_count == $counter) { echo '</div>'; } if ($counter % $item_width == 0 && $post_count != $counter) { echo '<hr class="style-four">'; } $counter++; } echo '</section>'; if ($pagination) { rt_get_pagination($theQuery); } wp_reset_query(); $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
/** * Testimonanials * @param array $atts * @param string $content * @return output */ function rt_testimonials($atts, $content = null) { global $client_images; //counter $counter = 1; //defaults extract(shortcode_atts(array("id" => 'testimonial-' . rand(100000, 1000000), "class" => '', "list_layout" => "1/1", "ids" => array(), "item_per_page" => 9, "list_orderby" => "date", "list_order" => "DESC", "pagination" => "false", "style" => "left", "client_images" => "true", "categories" => ""), $atts)); //product id numbders $ids = !empty($ids) ? explode(",", trim($ids)) : array(); //item width percentage $list_layout = !empty($list_layout) ? $list_layout : "1/3"; //row count $column_count = rt_column_count($list_layout); //paged if ($pagination !== "false") { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } } else { $paged = 0; } //create a post status array $post_status = is_user_logged_in() ? array('private', 'publish') : "publish"; //general query $args = array('post_status' => $post_status, 'post_type' => 'testimonial', 'orderby' => $list_orderby, 'order' => $list_order, 'posts_per_page' => $item_per_page, 'paged' => $paged); if (!empty($ids)) { $args = array_merge($args, array('post__in' => $ids)); } if (!empty($categories)) { $categories = is_array($categories) ? $categories : explode(",", rt_wpml_lang_object_ids($categories, "testimonial_categories")); $args = array_merge($args, array('tax_query' => array(array('taxonomy' => 'testimonial_categories', 'field' => 'id', 'terms' => $categories, 'operator' => "IN")))); } ob_start(); $theQuery = new WP_Query($args); //get page & post counts $post_count = $theQuery->post_count; //add additional classes $class .= " " . $style; //column class $add_column_class = rt_column_class($list_layout); //id attr $id_attr = !empty($id) ? 'id="' . sanitize_html_class($id) . '"' : ""; echo '<section ' . $id_attr . ' class="border_grid testimonials clearfix ' . $class . ' " data-column-width="' . $column_count . '">'; while ($theQuery->have_posts()) { $theQuery->the_post(); //add first last classes if filterable is off $add_class = ""; if ($counter % $column_count == 1 || $column_count == 1) { $add_class .= " first"; } if (($counter % $column_count == 0 || $post_count == $counter) && $add_class == "") { $add_class .= " last"; } //post class $add_class .= " " . implode(get_post_class("loop"), " "); //open row block if ($counter % $column_count == 1 || $column_count == 1) { echo '<div class="row">'; } printf('<div id="%s" class="testimonial col %s %s">' . "\n", get_the_ID(), $add_column_class, $add_class); get_template_part('testimonial-contents/content'); echo '</div>' . "\n"; //close row block and add hr if ($counter % $column_count == 0 || $post_count == $counter) { echo '</div>'; } $counter++; } echo '</section>'; if ($pagination !== "false") { rt_get_pagination($theQuery); } wp_reset_postdata(); $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }