function vcex_staff_grid_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'term_slug' => '', 'include_categories' => '', 'exclude_categories' => '', 'posts_per_page' => '12', 'grid_style' => 'fit_columns', 'masonry_layout_mode' => '', 'filter_speed' => '', 'masonry_layout_mode' => '', 'equal_heights_grid' => '', 'columns' => '', 'order' => 'DESC', 'orderby' => 'date', 'orderby_meta_key' => '', 'filter' => '', 'center_filter' => '', 'img_crop' => 'true', 'img_width' => '9999', 'img_height' => '9999', 'thumb_link' => 'post', 'thumb_lightbox_gallery' => '', 'thumb_lightbox_title' => '', 'img_filter' => '', 'title' => 'true', 'title_link' => 'post', 'excerpt' => 'true', 'excerpt_length' => '15', 'custom_excerpt_trim' => '', 'read_more' => '', 'read_more_text' => __('read more', 'wpex'), 'pagination' => 'false', 'filter_content' => 'false', 'social_links' => 'true', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'img_hover_style' => '', 'img_rendering' => '', 'all_text' => __('All', 'wpex'), 'overlay_style' => '', 'content_heading_margin' => '', 'content_background' => '', 'content_margin' => '', 'content_font_size' => '', 'content_padding' => '', 'content_border' => '', 'content_color' => '', 'content_opacity' => '', 'content_heading_color' => '', 'content_heading_size' => '', 'content_alignment' => '', 'readmore_background' => '', 'readmore_color' => '', 'position' => '', 'position_size' => '', 'position_margin' => '', 'position_color' => '', 'single_column_style' => ''), $atts)); // Turn output buffer on ob_start(); // Don't create custom tax if tax doesn't exist if (taxonomy_exists('staff_category')) { // Include categories $include_categories = '' != $include_categories ? $include_categories : $term_slug; $include_categories = 'all' == $include_categories ? '' : $include_categories; $filter_cats_include = ''; if ($include_categories) { $include_categories = explode(',', $include_categories); $filter_cats_include = array(); foreach ($include_categories as $key) { $key = get_term_by('slug', $key, 'staff_category'); $filter_cats_include[] = $key->term_id; } } // Exclude categories $filter_cats_exclude = ''; if ($exclude_categories) { $exclude_categories = explode(',', $exclude_categories); if (!empty($exclude_categories) && is_array($exclude_categories)) { $filter_cats_exclude = array(); foreach ($exclude_categories as $key) { $key = get_term_by('slug', $key, 'staff_category'); $filter_cats_exclude[] = $key->term_id; } $exclude_categories = array('taxonomy' => 'staff_category', 'field' => 'slug', 'terms' => $exclude_categories, 'operator' => 'NOT IN'); } else { $exclude_categories = ''; } } // Start Tax Query if (!empty($include_categories) && is_array($include_categories)) { $include_categories = array('taxonomy' => 'staff_category', 'field' => 'slug', 'terms' => $include_categories, 'operator' => 'IN'); } else { $include_categories = ''; } } // Meta key for orderby if ($orderby_meta_key && ('meta_value_num' == $orderby || 'meta_value' == $orderby)) { $meta_key = $orderby_meta_key; } else { $meta_key = NULL; } // Pagination var $paged = NULL; $no_found_rows = true; if ('true' == $pagination) { global $paged; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $paged = NULL; $no_found_rows = false; } // The Query global $post; $wpex_query = NULL; $wpex_query = new WP_Query(array('post_type' => 'staff', 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'paged' => $paged, 'meta_key' => $meta_key, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories), 'no_found_rows' => $no_found_rows)); // Output posts if ($wpex_query->posts) { // Main Vars $unique_id = $unique_id ? $unique_id : 'staff-' . rand(1, 100); // Image hard crop if ('9999' == $img_height) { $img_crop = false; } else { $img_crop = true; } // Equal heights class if ('1' != $columns && ('fit_columns' == $grid_style && 'true' == $equal_heights_grid)) { $equal_heights_grid = true; } else { $equal_heights_grid = false; } // Is Isotope var if ('true' == $filter || 'masonry' == $grid_style) { $is_isotope = true; } else { $is_isotope = false; } // No need for masonry if not enough columns and filter is disabled if ('true' != $filter && 'masonry' == $grid_style) { $post_count = count($wpex_query->posts); if ($post_count <= $columns) { $is_isotope = false; } } // Output script for inline JS for the Visual composer front-end builder if ($is_isotope) { vcex_front_end_grid_js('isotope'); } // Content Design $content_style = ''; if ($content_background) { $content_style .= 'background:' . $content_background . ';'; } if ($content_padding) { $content_style .= 'padding:' . $content_padding . ';'; } if ($content_margin) { $content_style .= 'margin:' . $content_margin . ';'; } if ($content_border) { $content_style .= 'border:' . $content_border . ';'; } if ($content_font_size) { $content_style .= 'font-size:' . $content_font_size . ';'; } if ($content_color) { $content_style .= 'color:' . $content_color . ';'; } if ($content_opacity) { $content_style .= 'opacity:' . $content_opacity . ';'; } if ($content_alignment) { $content_style .= 'text-align:' . $content_alignment . ';'; } if ($content_style) { $content_style = 'style="' . $content_style . '"'; } // Heading Design $heading_style = ''; if ($content_heading_margin) { $heading_style .= 'margin:' . $content_heading_margin . ';'; } if ($content_heading_size) { $heading_style .= 'font-size:' . $content_heading_size . ';'; } if ($content_heading_color) { $heading_style .= 'color:' . $content_heading_color . ';'; } if ($heading_style) { $heading_style = 'style="' . $heading_style . '"'; } // Position design if ('true' == $position) { $position_style = ''; if ($position_size) { $position_style .= 'font-size:' . $position_size . ';'; } if ($position_margin) { $position_style .= 'margin:' . $position_margin . ';'; } if ($position_color) { $position_style .= 'color:' . $position_color . ';'; } if ($position_style) { $position_style = 'style="' . $position_style . '"'; } } // Readmore design if ('true' == $read_more) { $readmore_style = ''; if ($readmore_background) { $readmore_style .= 'background:' . $readmore_background . ';'; } if ($readmore_color) { $readmore_style .= 'color:' . $readmore_color . ';'; } if ($readmore_style) { $readmore_style = 'style="' . $readmore_style . '"'; } } // Display filter links if ($filter == 'true' && taxonomy_exists('staff_category')) { $terms = get_terms('staff_category', array('include' => $filter_cats_include, 'exclude' => $filter_cats_exclude)); if ($terms && count($terms) > '1') { $center_filter = 'yes' == $center_filter ? 'center' : ''; ?> <ul class="vcex-staff-filter filter-<?php echo $unique_id; ?> vcex-filter-links <?php echo $center_filter; ?> clr"> <li class="active"><a href="#" data-filter="*"><span><?php echo $all_text; ?> </span></a></li> <?php foreach ($terms as $term) { ?> <li><a href="#" data-filter=".cat-<?php echo $term->term_id; ?> "><?php echo $term->name; ?> </a></li> <?php } ?> </ul><!-- .vcex-staff-filter --> <?php } ?> <?php } // Overlays if (function_exists('wpex_overlay_classname')) { $overlay_classnames = wpex_overlay_classname($overlay_style); } else { $overlay_classnames = ''; } // Image Filter class $img_filter_class = $img_filter ? 'vcex-' . $img_filter : ''; // Image hover styles $img_hover_style_class = $img_hover_style ? 'vcex-img-hover-parent vcex-img-hover-' . $img_hover_style : ''; // Wrap classes $wrap_classes = 'wpex-row vcex-staff-grid clr'; if ($is_isotope) { $wrap_classes .= ' vcex-isotope-grid'; } if ('left_thumbs' == $single_column_style) { $wrap_classes .= ' left-thumbs'; } // Lightbox classes if ('true' == $thumb_lightbox_gallery) { $wrap_classes .= ' lightbox-group'; $lightbox_single_class = ' lightbox-group-item'; } else { $lightbox_single_class = ' wpex-lightbox'; } // Data Attributes $data = ''; if ($is_isotope && 'true' == $filter) { if ('no_margins' != $grid_style && $masonry_layout_mode) { $data .= ' data-layout-mode="' . $masonry_layout_mode . '"'; } if ($filter_speed) { $data .= ' data-transition-duration="' . $filter_speed . '"'; } } ?> <div class="<?php echo $wrap_classes; ?> " id="<?php echo $unique_id; ?> "<?php echo $data; ?> > <?php // Define counter var to clear floats $count = $count_all = ''; // Start loop foreach ($wpex_query->posts as $post) { setup_postdata($post); // Open match-height-row div for equal heights if ($equal_heights_grid && !$is_isotope) { if (0 == $count) { ?> <div class="match-height-row clr"> <?php } $count_all++; } // Post Data $post_id = $post->ID; $post_title = get_the_title($post_id); $post_title_esc = esc_attr(the_title_attribute('echo=0')); $post_permalink = get_permalink($post_id); // Add to the counter var $count++; // Add classes to the entries $entry_classes = 'staff-entry col'; $entry_classes .= ' span_1_of_' . $columns; if ($is_isotope) { $entry_classes .= ' vcex-isotope-entry'; } if ($img_rendering) { $entry_classes .= ' vcex-image-rendering-' . $img_rendering; } if ($img_rendering) { $entry_classes .= ' vcex-image-rendering-' . $img_rendering; } $entry_classes .= ' col-' . $count; // Categories if (taxonomy_exists('staff_category')) { $post_terms = get_the_terms($post, 'staff_category'); if ($post_terms) { foreach ($post_terms as $post_term) { $entry_classes .= ' cat-' . $post_term->term_id; } } } ?> <div id="#post-<?php the_ID(); ?> " class="<?php echo $entry_classes; ?> "> <?php //Featured Image if (has_post_thumbnail()) { // Full Image URL $full_img_url = wp_get_attachment_url(get_post_thumbnail_id()); // Categories if (taxonomy_exists('staff_category')) { $post_terms = get_the_terms($post, 'staff_category'); if ($post_terms) { foreach ($post_terms as $post_term) { $entry_classes .= ' cat-' . $post_term->term_id; } } } ?> <div class="staff-entry-media clr <?php echo $img_filter_class; ?> <?php echo $img_hover_style_class; ?> <?php echo $overlay_classnames; ?> "> <?php if ('post' == $thumb_link || 'lightbox' == $thumb_link) { // Link to post if ('post' == $thumb_link) { ?> <a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title_esc; ?> " class="staff-entry-media-link"> <?php } elseif ($thumb_link == 'lightbox') { // Display lightbox title $data = ''; if ('true' == $thumb_lightbox_title) { $data = ' data-title="' . $post_title_esc . '"'; } ?> <a href="<?php echo $full_img_url; ?> " title="<?php echo $post_title_esc; ?> " class="staff-entry-media-link<?php echo $lightbox_single_class; ?> "<?php echo $data; ?> > <?php } } // Get cropped image array and display image $cropped_img = wpex_image_resize($full_img_url, intval($img_width), intval($img_height), $img_crop, 'array'); ?> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php the_title(); ?> " class="staff-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> <?php if ('post' == $thumb_link || 'lightbox' == $thumb_link) { // Inner Overlay if (function_exists('wpex_overlay')) { wpex_overlay('inside_link', $overlay_style); } ?> </a> <?php } // Outside Overlay if (function_exists('wpex_overlay')) { wpex_overlay('outside_link', $overlay_style); } ?> </div><!-- .staff-media --> <?php } ?> <?php if ('true' == $title || 'true' == $excerpt || 'true' == $read_more || 'true' == $position) { ?> <div class="staff-entry-details clr" <?php echo $content_style; ?> > <?php // Equal height div if ($equal_heights_grid && !$is_isotope) { ?> <div class="match-height-content"> <?php } // Display the title if ('true' == $title) { ?> <h2 class="staff-entry-title" <?php echo $heading_style; ?> > <?php if ('post' == $title_link) { ?> <a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title_esc; ?> " <?php echo $heading_style; ?> ><?php the_title(); ?> </a> <?php } else { ?> <?php the_title(); ?> <?php } ?> </h2><!-- .staff-entry-title --> <?php } // Display staff member position if ('true' == $position && '' != get_post_meta($post_id, 'wpex_staff_position', true)) { ?> <div class="staff-entry-position" <?php echo $position_style; ?> > <?php echo get_post_meta($post_id, 'wpex_staff_position', true); ?> </div><!-- .staff-entry-position --> <?php } // Display the excerpt if ('true' == $excerpt) { ?> <div class="staff-entry-excerpt clr"> <?php // Dusplay full content if ('9999' == $excerpt_length) { the_content(); } else { $trim_custom_excerpts = 'true' == $custom_excerpt_trim ? true : false; $excerpt_array = array('length' => intval($excerpt_length), 'trim_custom_excerpts' => $trim_custom_excerpts); vcex_excerpt($excerpt_array); } ?> </div><!-- .staff-entry-excerpt --> <?php } // Display social links if (function_exists('wpex_get_staff_social') && 'true' == $social_links) { echo wpex_get_staff_social(); } // Read more button if ('true' == $read_more) { ?> <a href="<?php echo get_permalink(); ?> " title="<?php $read_more_text; ?> " rel="bookmark" class="vcex-readmore theme-button" <?php echo $readmore_style; ?> > <?php echo $read_more_text; ?> <span class="vcex-readmore-rarr"><?php echo wpex_element('rarr'); ?> </span> </a> <?php } // Close Equal height div if ($equal_heights_grid && !$is_isotope) { ?> </div> <?php } ?> </div><!-- .staff-entry-details --> <?php } ?> </div><!-- .staff-entry --> <?php // Reset counter if ($count == $columns) { // Close equal height row if ($equal_heights_grid && !$is_isotope) { echo '</div><!-- .match-height-row -->'; } // Reset counter $count = ''; } // End foreach } // Make sure match-height-row is closed if ($equal_heights_grid && !$is_isotope) { if ('4' == $columns && $count_all % 4 != 0) { echo '</div><!-- .match-height-row -->'; } if ('3' == $columns && $count_all % 3 != 0) { echo '</div><!-- .match-height-row -->'; } if ('2' == $columns && $count_all % 2 != 0) { echo '</div><!-- .match-height-row -->'; } } ?> </div><!-- .vcex-staff-grid --> <?php // Paginate Posts if ('true' == $pagination) { wpex_pagination($wpex_query); } // End has posts check } // Reset the WP query $wpex_query = NULL; wp_reset_postdata(); // Return outbut buffer return ob_get_clean(); }
<?php } ?> <?php // Display social links if ('true' == $social_links) { ?> <div class="sfaff-entry-social-links wpex-clr"<?php echo $social_links_inline_css; ?> > <?php echo wpex_get_staff_social(array('style' => $social_links_style, 'font_size' => $social_links_size)); ?> </div><!-- .staff-entry-social-links --> <?php } ?> <?php // Display Readmore if ('true' == $read_more && $read_more_text) { ?> <div class="staff-entry-readmore-wrap entry-readmore-wrap clr"> <a href="<?php
function vcex_staff_carousel_shortcode($atts) { // Define shortcode params extract(shortcode_atts(array('unique_id' => '', 'term_slug' => 'all', 'style' => 'default', 'count' => '8', 'item_width' => '230', 'min_slides' => '1', 'max_slides' => '4', 'items_scroll' => 'page', 'animation' => 'CSS', 'auto_play' => 'false', 'timeout_duration' => '5000', 'arrows' => 'true', 'order' => 'DESC', 'orderby' => 'date', 'thumbnail_link' => 'post', 'img_crop' => 'false', 'img_width' => '9999', 'img_height' => '9999', 'title' => 'true', 'excerpt' => 'true', 'excerpt_length' => '30', 'filter_content' => 'false', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'social' => '', 'img_hover_style' => ''), $atts)); $output = ''; // Required Scripts wp_enqueue_script('vcex-caroufredsel'); // Give caroufredsel a unique name $rand_num = rand(1, 100); $unique_carousel_id = 'caroufredsel-' . $rand_num; // Output filter JS into the footer like a WP Jedi Master $output .= ' <script type="text/javascript"> jQuery(function($){ $(document).ready(function(){ $("#' . $unique_carousel_id . '").carouFredSel({ responsive : true, height: "variable", width : "100%", auto : { play: ' . $auto_play . ', timeoutDuration : ' . $timeout_duration . ', }, swipe : { onTouch: true, onMouse: true },'; if ($items_scroll !== 'page') { $output .= 'scroll : { items : ' . $items_scroll . ', },'; } if ($arrows == 'true') { $output .= 'prev : "#prev-' . $rand_num . '",'; $output .= 'next : "#next-' . $rand_num . '",'; } $output .= 'items : { width : ' . intval($item_width) . ', height: "variable", visible : { min : ' . intval($min_slides) . ', max : ' . intval($max_slides) . ' } } }); }); $(window).load(function(){ $(".vcex-caroufredsel-loading").removeClass("vcex-caroufredsel-loading"); $(".vcex-caroufredsel").animate({ opacity: 1 }); }); }); </script>'; // Start Tax Query if ($term_slug !== 'all') { $tax_query = array(array('taxonomy' => 'staff_category', 'field' => 'slug', 'terms' => $term_slug)); } else { $tax_query = NULL; } // The Query $vcex_carousel_query = new WP_Query(array('post_type' => 'staff', 'posts_per_page' => $count, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'no_found_rows' => true, 'tax_query' => $tax_query, 'meta_query' => array(array('key' => '_thumbnail_id')))); //Output posts if ($vcex_carousel_query->posts) { $unique_id = $unique_id ? ' id="' . $unique_id . '"' : NULL; // Main wrapper div $output .= '<div class="vcex-caroufredsel-wrap clr vcex-caroufredsel-staff vcex-caroufredsel-' . $style . ' vcex-caroufredsel-loading"' . $unique_id . '>'; $output .= '<div class="vcex-caroufredsel"><ul id="' . $unique_carousel_id . '">'; // Loop through posts foreach ($vcex_carousel_query->posts as $post) { // Post VARS $postid = $post->ID; $featured_img_url = wp_get_attachment_url(get_post_thumbnail_id($postid)); $featured_img = wp_get_attachment_url(get_post_thumbnail_id($postid)); $url = get_permalink($postid); $post_title = get_the_title($postid); $the_content = $post->post_content; // Load scripts if ($thumbnail_link == 'lightbox') { wp_enqueue_script('vcex-magnific-popup'); wp_enqueue_script('vcex-lightbox'); } // Crop featured images if necessary if ($img_crop == 'true') { $thumbnail_hard_crop = $img_height == '9999' ? false : true; $img_width = intval($img_width); $img_height = intval($img_height); $featured_img = aq_resize($featured_img_url, $img_width, $img_height, $thumbnail_hard_crop); } // Carousel item start $output .= '<li class="vcex-caroufredsel-slide">'; // Image hover styles $img_hover_style_class = $img_hover_style ? 'vcex-img-hover-parent vcex-img-hover-' . $img_hover_style : ''; // Media Wrap if (has_post_thumbnail($postid)) { $output .= '<div class="vcex-caroufredsel-entry-media ' . $img_hover_style_class . '">'; if ($thumbnail_link == 'none') { $output .= '<img src="' . $featured_img . '" alt="' . $post_title . '" />'; } elseif ($thumbnail_link == 'lightbox') { $output .= '<a href="' . $featured_img_url . '" title="' . $post_title . '" class="vcex-caroufredsel-entry-img vcex-lightbox">'; $output .= '<img src="' . $featured_img . '" alt="' . $post_title . '" />'; if (function_exists('wpex_get_staff_overlay')) { $output .= wpex_get_staff_overlay(); } $output .= '</a><!-- .vcex-caroufredsel-entry-img -->'; } else { $output .= '<a href="' . $url . '" title="' . $post_title . '" class="vcex-caroufredsel-entry-img">'; $output .= '<img src="' . $featured_img . '" alt="' . $post_title . '" />'; if (function_exists('wpex_get_staff_overlay')) { $output .= wpex_get_staff_overlay(); } $output .= '</a><!-- .vcex-caroufredsel-entry-img -->'; } $output .= '</div>'; } if ($title == 'true' || $excerpt == 'true') { $output .= '<div class="vcex-caroufredsel-entry-details">'; if ($title == 'true' && $post_title) { $centered_title = $excerpt ? '' : 'textcenter'; $output .= '<div class="vcex-caroufredsel-entry-title ' . $centered_title . '"><a href="' . $url . '" title="' . $post_title . '">' . $post_title . '</a></div>'; } if ($excerpt == 'true' && !empty($the_content)) { if (has_excerpt($postid)) { $the_excerpt = $post->post_excerpt; $output .= '<div class="vcex-caroufredsel-entry-excerpt">' . $the_excerpt . '</div>'; } else { $output .= '<div class="vcex-caroufredsel-entry-excerpt">' . wp_trim_words($the_content_stripped, $excerpt_length) . '</div>'; } // Display social links if (function_exists('wpex_get_staff_social') && $social !== 'false') { $output .= wpex_get_staff_social($postid); } } $output .= '</div>'; } // Close main wrap $output .= '</li>'; // End foreach loop } // End UL $output .= '</ul>'; // Next/Prev arrows if ($arrows == 'true') { $output .= '<div id="prev-' . $rand_num . '" class="vcex-caroufredsel-prev theme-button"><span class="fa fa-chevron-left"></span></div><div id="next-' . $rand_num . '" class="vcex-caroufredsel-next theme-button"><span class="fa fa-chevron-right"></span></div>'; } // Close main wrap $output .= '</div></div><div class="vcex-clear-floats"></div>'; } // End has posts check // Set things back to normal $vcex_carousel_query = NULL; wp_reset_postdata(); // Return data return $output; }
function vcex_staff_grid_shortcode($atts) { // Define shortcode params extract(shortcode_atts(array('unique_id' => '', 'term_slug' => 'all', 'posts_per_page' => '12', 'grid_style' => 'fit_columns', 'columns' => '', 'order' => 'DESC', 'orderby' => 'date', 'filter' => 'true', 'thumbnail_link' => 'post', 'img_crop' => 'true', 'img_width' => '9999', 'img_height' => '9999', 'thumb_link' => 'post', 'img_filter' => '', 'title' => 'true', 'excerpt' => 'true', 'excerpt_length' => '15', 'read_more' => 'false', 'read_more_text' => __('read more', 'vcex'), 'pagination' => 'false', 'filter_content' => 'false', 'social_links' => 'true', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'img_hover_style' => '', 'img_overlay_disable' => ''), $atts)); // Get global $post var global $post; // Start Tax Query $tax_query = ''; if ($term_slug !== '' && $term_slug !== 'all') { $tax_query = array(array('taxonomy' => 'staff_category', 'field' => 'slug', 'terms' => $term_slug)); } // Pagination var if ($pagination == 'true') { global $paged; $paged = get_query_var('paged') ? get_query_var('paged') : 1; } else { $paged = NULL; } // The Query $vcex_query = new WP_Query(array('post_type' => 'staff', 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'tax_query' => $tax_query, 'filter_content' => $filter_content, 'paged' => $paged)); //Output posts if ($vcex_query->posts) { $rand_num = rand(1, 100); $unique_port_id = 'staff-' . $rand_num; $unique_id = $unique_id ? ' id="' . $unique_id . '"' : 'id="' . $unique_port_id . '"'; $img_crop = $img_crop == 'true' ? true : false; $read_more = $read_more == 'true' ? true : false; // Set correct grid class $col_class = 'span_8'; if ($columns == '1') { $col_class = 'span_1_of_1'; } if ($columns == '2') { $col_class = 'span_1_of_2'; } if ($columns == '3') { $col_class = 'span_1_of_3'; } if ($columns == '4') { $col_class = 'span_1_of_4'; } if ($columns == '5') { $col_class = 'span_1_of_5'; } if ($columns == '6') { $col_class = 'span_1_of_6'; } if ($columns == '7') { $col_class = 'span_1_of_7'; } if ($columns == '8') { $col_class = 'span_1_of_8'; } if ($columns == '9') { $col_class = 'span_1_of_9'; } if ($columns == '10') { $col_class = 'span_1_of_10'; } if ($columns == '11') { $col_class = 'span_1_of_11'; } if ($columns == '12') { $col_class = 'span_1_of_12'; } // Looad lightbox scripts if ($thumb_link == 'lightbox') { wp_enqueue_script('vcex-magnific-popup'); wp_enqueue_script('vcex-lightbox'); } // Load Masonry scripts if ($filter == 'true' || $grid_style == 'masonry') { wp_enqueue_script('vcex-isotope'); // Load Isotope Script } ob_start(); ?> <?php // Display filter links if ($filter == 'true') { ?> <?php $filter_parent = $term_slug !== '' && $term_slug !== 'all' ? $term_slug : NULL; ?> <?php $terms = get_terms('staff_category', array('child_of' => $filter_parent)); ?> <?php if ($terms) { ?> <ul class="vcex-staff-filter filter-<?php echo $unique_port_id; ?> vcex-filter-links clr"> <li class="active"><a href="#" data-filter="*"><span><?php _e('All', 'vcex'); ?> </span></a></li> <?php foreach ($terms as $term) { ?> <li><a href="#" data-filter=".<?php echo $term->slug; ?> "><?php echo $term->name; ?> </a></li> <?php } ?> </ul><!-- .vcex-staff-filter --> <?php } ?> <?php } ?> <?php if ($filter == 'true' || $grid_style == 'masonry') { ?> <script type="text/javascript"> jQuery(function($){ $(window).load(function() { function wpexStaffIsotope() { var $container = $('#<?php echo $unique_port_id; ?> '); $container.isotope({ itemSelector: '.staff-entry', animationEngine: 'css', layoutMode: 'masonry' }); } wpexStaffIsotope(); var $filterLinks = $('.filter-<?php echo $unique_port_id; ?> a'); $filterLinks.each( function() { var $filterableDiv = $(this).data('filter'); if ( $filterableDiv == '*' ) { // ignore this one } else { if ( $($filterableDiv).width() ) { // keep these } else { // remove these $(this).parent().hide(); } } }); $filterLinks.css({ opacity: 1 } ); $filterLinks.click(function(){ var selector = $(this).attr('data-filter'); $('#<?php echo $unique_port_id; ?> ').isotope({ filter: selector }); $(this).parents('ul').find('li').removeClass('active'); $(this).parent('li').addClass('active'); return false; }); var isIE8 = $.browser.msie && +$.browser.version === 8; if (isIE8) { document.body.onresize = function () { wpexStaffIsotope(); }; } else { $(window).resize(function () { wpexStaffIsotope(); }); } window.addEventListener("orientationchange", function() { wpexStaffIsotope(); }); }); }); </script> <?php } ?> <div class="vcex-staff-grid vcex-clearfix <?php if ($filter == 'true' || $grid_style == 'masonry') { echo 'vcex-masonry-grid'; } ?> " <?php echo $unique_id; ?> > <?php $count = ''; foreach ($vcex_query->posts as $post) { setup_postdata($post); $count++; $post_id = get_the_ID(); ?> <?php $post_terms = get_the_terms($post, 'staff_category'); ?> <article id="#post-<?php the_ID(); ?> " class="staff-entry col <?php foreach ($post_terms as $post_term) { echo $post_term->slug . ' '; } ?> <?php echo $col_class; ?> <?php echo 'col-' . $count . ''; ?> "> <?php if (has_post_thumbnail()) { ?> <?php // Image Filter class $img_filter_class = $img_filter ? 'vcex-' . $img_filter : ''; ?> <?php // Image hover styles $img_hover_style_class = $img_hover_style ? 'vcex-img-hover-parent vcex-img-hover-' . $img_hover_style : ''; ?> <div class="staff-entry-media <?php echo $img_filter_class; ?> <?php echo $img_hover_style_class; ?> "> <?php if ($thumb_link == 'post' || $thumb_link == 'lightbox') { ?> <?php if ($thumb_link == 'post') { ?> <a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> "> <?php } ?> <?php if ($thumb_link == 'lightbox') { ?> <a href="<?php echo wp_get_attachment_url(get_post_thumbnail_id()); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> " class="vcex-lightbox"> <?php } ?> <?php } ?> <img src="<?php echo aq_resize(wp_get_attachment_url(get_post_thumbnail_id()), intval($img_width), intval($img_height), $img_crop); ?> " alt="<?php the_title(); ?> " class="staff-entry-img" /> <?php if ($thumb_link == 'post' || $thumb_link == 'lightbox') { ?> <?php if ($img_filter !== 'grayscale') { if ($img_overlay_disable !== 'yes') { // Display Staff Position if (get_post_meta(get_the_ID(), 'wpex_staff_position', true) !== '' && function_exists('wpex_get_staff_overlay')) { echo wpex_get_staff_overlay(); } } } ?> </a> <?php } ?> <?php // Display Staff Position if ($img_filter !== 'grayscale' && $thumb_link == 'nowhere' && function_exists('wpex_get_staff_overlay')) { echo wpex_get_staff_overlay(); } ?> </div><!-- .staff-dia --> <?php } ?> <?php if ($title == 'true' || $excerpt == 'true') { ?> <div class="staff-entry-details clr"> <?php if ($title == 'true') { ?> <h2 class="staff-entry-title"><a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> "><?php the_title(); ?> </a></h2> <?php } ?> <?php if ($excerpt == 'true') { ?> <div class="clr"></div> <div class="staff-entry-excerpt clr"> <?php if ($excerpt_length == "9999") { ?> <?php the_content(); ?> <?php } else { ?> <?php vcex_excerpt($excerpt_length, $read_more, $read_more_text); ?> <?php } ?> </div> <?php } ?> <?php // Display social links if (function_exists('wpex_get_staff_social') && $social_links == 'true') { echo wpex_get_staff_social($post_id); } ?> </div><!-- .staff-entry-details --> <?php } ?> </article><!-- .staff-entry --> <?php // Reset counter if ($count == $columns) { $count = ''; } ?> <?php } ?> </div><!-- .vcex-staff-grid --> <?php // Paginate Posts if ($pagination == 'true') { $total = $vcex_query->max_num_pages; $big = 999999999; // need an unlikely integer if ($total > 1) { if (!($current_page = get_query_var('paged'))) { $current_page = 1; } if (get_option('permalink_structure')) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => $format, 'current' => max(1, get_query_var('paged')), 'total' => $total, 'mid_size' => 2, 'type' => 'list', 'prev_text' => '<i class="fa fa-angle-left"></i>', 'next_text' => '<i class="fa fa-angle-right"></i>')); } } } // End has posts check // Set things back to normal wp_reset_postdata(); return ob_get_clean(); }
<?php } else { ?> <?php the_title(); ?> <?php } ?> </h2> <div class="staff-entry-excerpt clr"> <?php // Display excerpt $args = array('length' => get_theme_mod('staff_entry_excerpt_length', '20'), 'readmore' => false); wpex_excerpt($args); ?> </div><!-- .staff-entry-excerpt --> <?php // Displays social links for current staff member // @ functions/staff/staff-functions.php echo wpex_get_staff_social(); ?> <?php // Close Match Height div if (wpex_staff_match_height()) { ?> </div> <?php } ?> </div><!-- .staff-entry-details -->
function vcex_staff_carousel_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'classes' => '', 'style' => 'default', 'term_slug' => '', 'include_categories' => '', 'exclude_categories' => '', 'count' => '8', 'center' => 'false', 'timeout_duration' => '5000', 'items' => '4', 'items_margin' => '15', 'infinite_loop' => 'true', 'items_scroll' => '1', 'auto_play' => 'false', 'arrows' => 'true', 'order' => 'DESC', 'orderby' => 'date', 'orderby_meta_key' => '', 'thumbnail_link' => '', 'img_width' => '9999', 'img_height' => '9999', 'title' => 'true', 'excerpt' => 'true', 'excerpt_length' => '30', 'custom_excerpt_trim' => 'true', 'social' => '', 'taxonomy' => '', 'terms' => '', 'img_hover_style' => '', 'img_rendering' => '', 'overlay_style' => '', 'content_background' => '', 'content_heading_margin' => '', 'content_heading_weight' => '', 'content_heading_transform' => '', 'content_margin' => '', 'content_font_size' => '', 'content_padding' => '', 'content_border' => '', 'content_color' => '', 'content_opacity' => '', 'content_heading_color' => '', 'content_heading_size' => '', 'content_alignment' => '', 'tablet_items' => '3', 'mobile_landscape_items' => '2', 'mobile_portrait_items' => '1'), $atts)); // Turn output buffer on ob_start(); // Global post global $post; // Include categories $include_categories = '' != $include_categories ? $include_categories : $term_slug; $include_categories = 'all' == $include_categories ? '' : $include_categories; $filter_cats_include = ''; if ($include_categories) { $include_categories = explode(',', $include_categories); $filter_cats_include = array(); foreach ($include_categories as $key) { $key = get_term_by('slug', $key, 'staff_category'); $filter_cats_include[] = $key->term_id; } } // Exclude categories $filter_cats_exclude = ''; if ($exclude_categories) { $exclude_categories = explode(',', $exclude_categories); if (!empty($exclude_categories) && is_array($exclude_categories)) { $filter_cats_exclude = array(); foreach ($exclude_categories as $key) { $key = get_term_by('slug', $key, 'staff_category'); $filter_cats_exclude[] = $key->term_id; } $exclude_categories = array('taxonomy' => 'staff_category', 'field' => 'slug', 'terms' => $exclude_categories, 'operator' => 'NOT IN'); } else { $exclude_categories = ''; } } // Start Tax Query if (!empty($include_categories) && is_array($include_categories)) { $include_categories = array('taxonomy' => 'staff_category', 'field' => 'slug', 'terms' => $include_categories, 'operator' => 'IN'); } else { $include_categories = ''; } // Meta key for orderby if ($orderby_meta_key && ('meta_value_num' == $orderby || 'meta_value' == $orderby)) { $meta_key = $orderby_meta_key; } else { $meta_key = NULL; } // The Query $wpex_query = new WP_Query(array('post_type' => 'staff', 'posts_per_page' => $count, 'order' => $order, 'orderby' => $orderby, 'no_found_rows' => true, 'meta_key' => $meta_key, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories))); //Output posts if ($wpex_query->posts) { // Output js for front-end editor vcex_front_end_carousel_js(); // Give caroufredsel a unique name $rand_num = rand(1, 100); $unique_carousel_id = 'carousel-' . $rand_num; // Prevent auto play in visual composer if (wpex_is_front_end_composer()) { $auto_play = 'false'; } // Overlay Style if (empty($overlay_style)) { $overlay_style = 'none'; } else { $overlay_style = $overlay_style; } // Item Margin if ('no-margins' == $style) { $items_margin = '0'; } // Items to scroll fallback for old setting if ('page' == $items_scroll) { $items_scroll = $items; } // Unique ID if ($unique_id) { $unique_id = ' id="' . $unique_id . '"'; } // Main Classes $main_classes = 'wpex-carousel wpex-carousel-staff clr owl-carousel clr'; if ($style) { $main_classes .= ' wpex-carousel-' . $style; } if ($classes) { $main_classes .= ' ' . $classes; } // Entry media classes $media_classes = 'wpex-carousel-entry-media clr'; if ($img_hover_style) { $media_classes .= ' vcex-img-hover-parent vcex-img-hover-' . $img_hover_style; } if ($img_rendering) { $media_classes .= ' vcex-image-rendering-' . $img_rendering; } if ($overlay_style) { $media_classes .= ' ' . wpex_overlay_classname($overlay_style); } // Content Design $content_style = ''; if ($content_background) { $content_style .= 'background:' . $content_background . ';'; } if ($content_padding) { $content_style .= 'padding:' . $content_padding . ';'; } if ($content_margin) { $content_style .= 'margin:' . $content_margin . ';'; } if ($content_border) { $content_style .= 'border:' . $content_border . ';'; } if ($content_font_size) { $content_style .= 'font-size:' . $content_font_size . ';'; } if ($content_color) { $content_style .= 'color:' . $content_color . ';'; } if ($content_opacity) { $content_style .= 'opacity:' . $content_opacity . ';'; } if ($content_alignment) { $content_style .= 'text-align:' . $content_alignment . ';'; } if ($content_style) { $content_style = ' style="' . $content_style . '"'; } // Title design $heading_style = ''; if ($content_heading_margin) { $heading_style .= 'margin: ' . $content_heading_margin . ';'; } if ($content_heading_transform) { $heading_style .= 'text-transform: ' . $content_heading_transform . ';'; } if ($content_heading_weight) { $heading_style .= 'font-weight: ' . $content_heading_weight . ';'; } if ($content_heading_size) { $heading_style .= 'font-size: ' . $content_heading_size . ';'; } if ($heading_style) { $heading_style = ' style="' . $heading_style . '"'; } // Heading color if ($content_heading_color) { $content_heading_color = ' style="color: ' . $content_heading_color . ';"'; } ?> <div class="<?php echo $main_classes; ?> "<?php echo $unique_id; ?> data-items="<?php echo $items; ?> " data-slideby="<?php echo $items_scroll; ?> " data-nav="<?php echo $arrows; ?> " data-autoplay="<?php echo $auto_play; ?> " data-loop="<?php echo $infinite_loop; ?> " data-autoplay-timeout="<?php echo $timeout_duration; ?> " data-center="<?php echo $center; ?> " data-margin="<?php echo intval($items_margin); ?> " data-items-tablet="<?php echo $tablet_items; ?> " data-items-mobile-landscape="<?php echo $mobile_landscape_items; ?> " data-items-mobile-portrait="<?php echo $mobile_portrait_items; ?> "> <?php // Loop through posts foreach ($wpex_query->posts as $post) { setup_postdata($post); // Post VARS $postid = $post->ID; $featured_img_url = wp_get_attachment_url(get_post_thumbnail_id($postid)); $permalink = get_permalink($postid); $post_title = esc_attr(the_title_attribute('echo=0')); // Crop featured images if necessary if ('9999' == $img_height) { $img_crop = false; } else { $img_crop = true; } $featured_img = wpex_image_resize($featured_img_url, $img_width, $img_height, $img_crop, 'array'); ?> <div class="wpex-carousel-slide"> <?php // Media Wrap if (has_post_thumbnail()) { ?> <div class="<?php echo $media_classes; ?> "> <?php // No links if ('none' == $thumbnail_link) { ?> <img src="<?php echo $featured_img['url']; ?> " alt="<?php echo $post_title; ?> " width="<?php echo $featured_img['width']; ?> " height="<?php echo $featured_img['height']; ?> " /> <?php } elseif ('lightbox' == $thumbnail_link) { ?> <a href="<?php echo $featured_img_url; ?> " title="<?php echo $post_title; ?> " class="wpex-carousel-entry-img wpex-lightbox"> <img src="<?php echo $featured_img['url']; ?> " alt="<?php echo $post_title; ?> " width="<?php echo $featured_img['width']; ?> " height="<?php echo $featured_img['height']; ?> " /> <?php } else { ?> <a href="<?php echo $permalink; ?> " title="<?php echo $post_title; ?> " class="wpex-carousel-entry-img"> <img src="<?php echo $featured_img['url']; ?> " alt="<?php echo $post_title; ?> " width="<?php echo $featured_img['width']; ?> " height="<?php echo $featured_img['height']; ?> " /> <?php } ?> <?php // Overlay & close link if ('none' != $thumbnail_link) { // Inner Overlay if ($overlay_style) { wpex_overlay('inside_link', $overlay_style); } // Close link echo '</a><!-- .wpex-carousel-entry-img -->'; // Outside Overlay if ($overlay_style) { wpex_overlay('outside_link', $overlay_style); } } ?> </div><!-- .wpex-carousel-entry-media --> <?php } ?> <?php // Title if ('true' == $title || 'true' == $excerpt || 'true' == $social) { ?> <div class="wpex-carousel-entry-details clr"<?php echo $content_style; ?> > <?php // Title if ('true' == $title && $post_title) { ?> <div class="wpex-carousel-entry-title"<?php echo $heading_style; ?> > <a href="<?php echo $permalink; ?> " title="<?php echo $post_title; ?> "<?php echo $content_heading_color; ?> ><?php echo $post_title; ?> </a> </div> <?php } // Excerpt if ('true' == $excerpt) { if ('true' == $custom_excerpt_trim) { $custom_excerpt_trim = true; } else { $custom_excerpt_trim = false; } $excerpt_array = array('length' => intval($excerpt_length), 'readmore' => false, 'trim_custom_excerpts' => $custom_excerpt_trim); // Generate excerpt $get_excerpt = vcex_get_excerpt($excerpt_array); if ($get_excerpt) { ?> <div class="wpex-carousel-entry-excerpt clr"> <?php echo $get_excerpt; ?> </div><!-- .wpex-carousel-entry-excerpt --> <?php } ?> <?php } // Display social links if ('true' == $social) { echo wpex_get_staff_social(get_the_ID()); } ?> </div><!-- .wpex-carousel-entry-details --> <?php } ?> </div><!-- .wpex-carousel-slide --> <?php // End foreach loop } ?> </div><!-- .wpex-carousel --> <?php } // End has posts check // Set things back to normal wp_reset_postdata(); // Return outbut buffer return ob_get_clean(); }