"",
"number_of_visible_items" => "",
"orderby" => "date",
"order" => "ASC",
"show_in_two_rows" => ""
);
extract(shortcode_atts($args, $atts));
$html = "";
$carousel_holder_classes = "";
if ($carousel != "") {
if($show_in_two_rows == 'yes') {
$carousel_holder_classes = ' two_rows';
}
$visible_items = "";
switch ($number_of_visible_items) {
case 'four_items':
$visible_items = 4;
break;
case 'five_items':
$visible_items = 5;
break;
default:
$visible_items = "";
break;
}
$html .= "
";
$q = array('post_type'=> 'carousels', 'carousels_category' => $carousel, 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => '-1');
query_posts($q);
if ( have_posts() ) : $postCount = 1; while ( have_posts() ) : the_post();
if(get_post_meta(get_the_ID(), "qode_carousel-image", true) != ""){
$image = get_post_meta(get_the_ID(), "qode_carousel-image", true);
} else {
$image = "";
}
if(get_post_meta(get_the_ID(), "qode_carousel-hover-image", true) != ""){
$hover_image = get_post_meta(get_the_ID(), "qode_carousel-hover-image", true);
$has_hover_image = "has_hover_image";
} else {
$hover_image = "";
$has_hover_image = "";
}
if(get_post_meta(get_the_ID(), "qode_carousel-item-link", true) != ""){
$link = get_post_meta(get_the_ID(), "qode_carousel-item-link", true);
} else {
$link = "";
}
if(get_post_meta(get_the_ID(), "qode_carousel-item-target", true) != ""){
$target = get_post_meta(get_the_ID(), "qode_carousel-item-target", true);
} else {
$target = "_self";
}
$title = get_the_title();
//is current item not on even position in array and two rows option is chosen?
if($postCount % 2 !== 0 && $show_in_two_rows == 'yes') {
$html .= "- ";
} elseif($show_in_two_rows == '') {
$html .= "
- ";
}
$html .= '';
//is current item on even position in array and two rows option is chosen?
if($postCount % 2 == 0 && $show_in_two_rows == 'yes') {
$html .= "
";
} elseif($show_in_two_rows == '') {
$html .= "";
}
$postCount++;
endwhile;
else:
$html .= __('Sorry, no posts matched your criteria.','qode');
endif;
wp_reset_query();
$html .= "
";
$html .= "
";
}
return $html;
}
add_shortcode('qode_carousel', 'qode_carousel');
}