"date", "order" => "DESC", "category" => "", "author_image" => "", "title_tag" => 'h5', "title_size" => '', 'background_color' => '', 'author_size' => '', 'main_title' => '', "main_title_tag" => 'h3', "main_title_size" => '', 'description' => '', 'button_text' => '', 'button_link' => '', 'button_bckg_color' => '', 'link_target' => '_blank' ); extract(shortcode_atts($deafult_args, $atts)); $html = ""; $testimonials_array = array(); $args = array( 'post_type' => 'testimonials', 'orderby' => $order_by, 'order' => $order, 'posts_per_page' => '8' ); if ($category != "") { $args['testimonials_category'] = $category; } $headings_array = array('h2', 'h3', 'h4', 'h5', 'h6'); //get correct heading value. If provided heading isn't valid get the default one $title_tag = (in_array($title_tag, $headings_array)) ? $title_tag : $args['title_tag']; $main_title_tag = (in_array($main_title_tag, $headings_array)) ? $main_title_tag : $args['main_title_tag']; $title_style = ''; if ($title_size !== ''){ $valid_title_size = (strstr($title_size, 'px', true)) ? $title_size : $title_size.'px'; $title_style .= "font-size: ".$valid_title_size.";"; } if ($title_style !== ''){ $title_style = 'style="'.$title_style.'"'; } $main_title_style = ''; if ($title_size !== ''){ $valid_title_size = (strstr($main_title_size, 'px', true)) ? $main_title_size : $main_title_size.'px'; $main_title_style .= "font-size: ".$valid_title_size.";"; } if ($main_title_style !== ''){ $main_title_style = 'style="'.$main_title_style.'"'; } $testimonial_item_style = ''; if ($background_color !== ''){ $testimonial_item_style .= "background-color: ".$background_color.";"; } if ($testimonial_item_style !== ''){ $testimonial_item_style = 'style="'.$testimonial_item_style.'"'; } $author_style = ''; if ($author_size !== ''){ $valid_title_size = (strstr($author_size, 'px', true)) ? $author_size : $author_size.'px'; $author_style .= "font-size: ".$valid_title_size.";"; } if ($author_style !== ''){ $author_style = 'style="'.$author_style.'"'; } $button_html = ''; if($button_text !== ''){ $params = array(); $params['text'] = $button_text; if ($button_link !== ''){ $params['link'] = $button_link; } if ($link_target !== ''){ $params['target'] = $link_target; } if ($button_bckg_color !== ''){ $params['color'] = '#fff'; $params['background_color'] = $button_bckg_color; $params['border_color'] = $button_bckg_color; } $button_html .= qode_execute_shortcode('button',$params); } $main_block_header = ''; $main_block_header .= "
"; $main_block_header .= '
'; $main_block_header .= '
'; if ($main_title !== ''){ $main_block_header .= '<'.$main_title_tag.' class="testimonials_header_title" '.$main_title_style.'>'.$main_title.''; $main_block_header .= '
'; } if ($description !== ''){ $main_block_header .= '

'.$description.'

'; } $main_block_header .= $button_html; $main_block_header .= "
"; //close testimonial_content_inner $main_block_header .= "
"; //close testimonial_content_holder $main_block_header .= "
"; //close testimonial_content $single = ''; query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); $single = ''; $title = get_the_title(); $author = get_post_meta(get_the_ID(), "qode_testimonial-author", true); $text = get_post_meta(get_the_ID(), "qode_testimonial-text", true); $testimonial_author_image = wp_get_attachment_image_src(get_post_thumbnail_id(), "full"); $single .= '
'; $single .= '
'; $single .= '
'; if($author_image == "yes" && $testimonial_author_image[0] !== null){ $single .= '
'; $single .= ''; $single .= '
'; } $single .= '<'.$title_tag.' itemprop="name" class="testimonial_title" '.$title_style.'>'.$title.''; $single .= '
'; $single .= '
'; $single .= '
'; $single .= '

' . trim($text) . '

'; $single .= '
' . $author . '
'; $single .= '
'; //close testimonial_text_inner $single .= '
'; //close testimonial_text_holder $single .= '
'; //close testimonial_content_inner $single .= '
'; //close testimonial_content_holder $single .= '
'; //close testimonial_content $testimonials_array[] = $single; endwhile; else: $html .= __('Sorry, no posts matched your criteria.', 'qode'); endif; wp_reset_query(); if (count($testimonials_array) >= 8){ $html .= "
"; $html .= "
"; $html .= "
"; $html .= $main_block_header; $html .= "
"; $html .= "
"; $html .= $testimonials_array[0]; $html .= "
"; $html .= "
"; $html .= $testimonials_array[1]; $html .= "
"; $html .= "
"; //close tstm_block_1 $html .= "
"; $html .= "
"; $html .= $testimonials_array[2]; $html .= "
"; $html .= "
"; $html .= $testimonials_array[3]; $html .= "
"; $html .= "
"; $html .= $testimonials_array[4]; $html .= "
"; $html .= "
"; //close tstm_block_2 $html .= "
"; $html .= "
"; $html .= $testimonials_array[5]; $html .= "
"; $html .= "
"; $html .= $testimonials_array[6]; $html .= "
"; $html .= "
"; $html .= $testimonials_array[7]; $html .= "
"; $html .= "
"; //close tstm_block_3 $html .= '
'; //close testimonials_masonry_holder } return $html; } add_shortcode('testimonials_masonry', 'testimonials_masonry'); }