<div class="hb-gal-standard-description portfolio-description"> <h3><a href="<?php echo $perma; ?> "><span class="hb-gallery-item-name"><?php the_title(); ?> </span></a></h3> <div class="hb-gal-standard-count"><?php echo $filters_names_string; ?> </div> <?php if (hb_options('hb_portfolio_enable_likes')) { echo hb_print_portfolio_likes(get_the_ID()); } ?> <?php if (has_excerpt()) { echo '<p>' . get_the_excerpt() . '</p>'; } else { ?> <p><?php echo wp_trim_words(strip_shortcodes(get_the_content()), 20, NULL); ?> </p> <?php } ?>
function hb_portfolio_carousel_shortcode($params = array()) { extract(shortcode_atts(array('style' => '', 'visible_items' => '4', 'total_items' => '12', 'category' => '', 'orderby' => 'date', 'order' => 'DESC', 'carousel_speed' => '3000', 'auto_rotate' => 'yes', 'animation' => '', 'animation_delay' => '', 'class' => ''), $params)); if ($class != '') { $class = ' ' . $class; } if ($style != 'descriptive') { $style = 'standard'; } if ($auto_rotate == "no") { $auto_rotate = "false"; } else { $auto_rotate = "5000"; } if ($animation != '') { $animation = ' hb-animate-element ' . $animation; } if ($animation_delay != '') { // Remove ms or s, if entered in the attribute if (substr($height, -2) == 'ms') { $animation_delay = substr($height, 0, -2); } if (substr($height, -1) == 's') { $animation_delay = substr($height, 0, -1); } $animation_delay = ' data-delay="' . $animation_delay . '"'; } $output = ""; if ($category) { $category = str_replace(" ", "", $category); $category = explode(",", $category); $queried_items = new WP_Query(array('post_type' => 'portfolio', 'orderby' => $orderby, 'order' => $order, 'status' => 'publish', 'posts_per_page' => $total_items, 'tax_query' => array(array('taxonomy' => 'portfolio_categories', 'field' => 'slug', 'terms' => $category)))); } else { $queried_items = new WP_Query(array('post_type' => 'portfolio', 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => $total_items, 'status' => 'publish')); } $unique_id = rand(1, 10000); if ($queried_items->have_posts()) { $output .= '<div class="shortcode-wrapper shortcode-portfolio-carousel gallery-carousel-wrapper-2' . $class . $animation . '"' . $animation_delay . '>'; // Carousel Nav $output .= '<div id="carousel-nav-' . $unique_id . '" class="crsl-nav">'; $output .= '<a href="#" class="previous"><i class="icon-angle-left"></i></a>'; $output .= '<a href="#" class="next"><i class="icon-angle-right"></i></a>'; $output .= '</div>'; // Carousel Items $output .= '<div class="crsl-items init-carousel" id="carousel-' . $unique_id . '" data-navigation="carousel-nav-' . $unique_id . '" data-visible="' . $visible_items . '" data-speed="' . $carousel_speed . '" data-auto-rotate="' . $auto_rotate . '">'; $output .= '<div class="crsl-wrap">'; while ($queried_items->have_posts()) { $queried_items->the_post(); $thumb = get_post_thumbnail_id(); $filters_names = wp_get_post_terms(get_the_ID(), 'portfolio_categories', array("fields" => "names")); $filters_names_string = implode($filters_names, ", "); $output .= '<div class="standard-gallery-item crsl-item" data-value="' . get_the_time('c') . '">'; if ($thumb) { $image = hb_resize($thumb, '', 586, 349, true); $output .= '<div class="hb-gal-standard-img-wrapper">'; $output .= '<a href="' . get_permalink() . '">'; $output .= '<img src="' . $image['url'] . '" width="' . $image['width'] . '" height="' . $image['height'] . '" alt="Portfolio Image" />'; $output .= '<div class="item-overlay"></div>'; $output .= '<div class="item-overlay-text">'; $output .= '<div class="item-overlay-text-wrap">'; $output .= '<span class="plus-sign"></span>'; $output .= '</div>'; $output .= '</div>'; $output .= '</a>'; $output .= '</div>'; } $output .= '<div class="hb-gal-standard-description portfolio-description">'; $output .= '<h3><a href="' . get_permalink() . '"><span class="hb-gallery-item-name">' . get_the_title() . '</span></a></h3>'; if ($filters_names_string) { $output .= '<div class="hb-gal-standard-count">' . $filters_names_string . '</div>'; } if (hb_options('hb_portfolio_enable_likes')) { $output .= hb_print_portfolio_likes(get_the_ID()); } if ($style == "descriptive") { if (has_excerpt()) { $output .= '<p>' . get_the_excerpt() . '</p>'; } else { $output .= wp_trim_words(strip_shortcodes(get_the_content()), 10, NULL); } $output .= '<div class="portfolio-small-meta clearfix">'; $output .= '<span class="float-left project-date">' . get_the_time('F d, Y') . '</span>'; $output .= '<a href="' . get_permalink() . '" class="float-right details-link">' . __('Details', 'hbthemes') . ' <i class="icon-angle-right"></i></a>'; $output .= '</div>'; } $output .= '</div>'; $output .= '</div>'; } $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; } wp_reset_query(); return $output; }