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(); }
function vcex_post_type_flexslider_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'post_types' => 'post', 'tax_query' => '', 'tax_query_taxonomy' => '', 'tax_query_terms' => '', 'posts_per_page' => '4', 'order' => 'DESC', 'orderby' => 'date', 'filter_content' => 'false', 'offset' => 0, 'animation' => 'slide', 'slideshow' => 'true', 'randomize' => 'false', 'direction' => 'horizontal', 'slideshow_speed' => '7000', 'animation_speed' => '600', 'control_nav' => 'true', 'direction_nav' => 'true', 'pause_on_hover' => 'true', 'smooth_height' => 'true', 'img_width' => '9999', 'img_height' => '9999', 'caption' => true, 'caption_location' => 'over-slider', 'control_thumbs' => 'false', 'title' => 'true', 'excerpt' => 'true', 'excerpt_length' => '40'), $atts)); // Turn output buffer on ob_start(); // Get global $post var global $post; // Post types $post_types = $post_types ? $post_types : 'post'; $post_types = explode(',', $post_types); // Tax Query if ('' != $tax_query && '' != $tax_query_taxonomy && '' != $tax_query_terms) { $tax_query_terms = explode(',', $tax_query_terms); $tax_query = array(array('taxonomy' => $tax_query_taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms)); } else { $tax_query = ''; } // Build new query $vcex_query = new WP_Query(array('post_type' => $post_types, 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'meta_query' => array(array('key' => '_thumbnail_id')), 'no_found_rows' => true, 'tax_query' => $tax_query)); //Output posts if ($vcex_query->posts) { // Output script for inline JS for the Visual composer front-end builder if (function_exists('vcex_front_end_slider_js')) { vcex_front_end_slider_js(); } // Control Thumbnails if ('true' == $control_thumbs) { $control_nav = 'thumbnails'; } else { $control_nav = $control_nav; } // Flexslider Data $flexslider_data = 'data-animation="' . $animation . '"'; $flexslider_data .= ' data-slideshow="' . $slideshow . '"'; $flexslider_data .= ' data-randomize="' . $randomize . '"'; $flexslider_data .= ' data-direction="' . $direction . '"'; $flexslider_data .= ' data-slideshow-speed="' . $slideshow_speed . '"'; $flexslider_data .= ' data-animation-speed="' . $animation_speed . '"'; $flexslider_data .= ' data-direction-nav="' . $direction_nav . '"'; $flexslider_data .= ' data-pause="' . $pause_on_hover . '"'; $flexslider_data .= ' data-smooth-height="' . $smooth_height . '"'; $flexslider_data .= ' data-control-nav="' . $control_nav . '"'; // Main Vars $unique_id = $unique_id ? ' id="' . $unique_id . '"' : NULL; $img_crop = $img_height == '9999' ? false : true; ?> <div class="vcex-flexslider-wrap clr vcex-img-flexslider vcex-posttypes-flexslider"<?php echo $unique_id; ?> > <div class="vcex-flexslider flexslider" <?php echo $flexslider_data; ?> > <ul class="slides"> <?php // Loop through posts foreach ($vcex_query->posts as $post) { setup_postdata($post); $img_url = wp_get_attachment_url(get_post_thumbnail_id()); // Thumb Data attr if ('true' == $control_thumbs) { $data_thumb = 'data-thumb="' . wpex_image_resize($img_url, 100, 100, true) . '"'; } else { $data_thumb = ''; } ?> <li class="vcex-flexslider-slide slide" <?php echo $data_thumb; ?> > <div class="vcex-flexslider-entry-media"> <?php if (has_post_thumbnail()) { $cropped_img = wpex_image_resize($img_url, intval($img_width), intval($img_height), $img_crop, 'array'); if ($cropped_img && is_array($cropped_img)) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php the_title(); ?> " class="vcex-post-type-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> </a> <?php } ?> <?php } // WooComerce Price if (class_exists('Woocommerce') && 'product' == get_post_type()) { ?> <div class="slider-woocommerce-price"> <?php $product = get_product(get_the_ID()); echo $product->get_price_html(); ?> </div><!-- .slider-woocommerce-price --> <?php } ?> <?php if ('true' == $caption) { ?> <div class="vcex-img-flexslider-caption clr <?php echo $caption_location; ?> "> <?php // Display title if ('true' == $title) { ?> <div class="title clr"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a> <?php if ('staff' == get_post_type() && get_post_meta(get_the_ID(), 'wpex_staff_position', true)) { ?> <div class="staff-position"> <?php echo get_post_meta(get_the_ID(), 'wpex_staff_position', true); ?> </div> <?php } ?> </div> <?php } // Display excerpt if ('true' == $excerpt) { ?> <div class="excerpt clr"> <?php $excerpt_array = array('length' => intval($excerpt_length)); vcex_excerpt($excerpt_array); ?> </div><!-- .excerpt --> <?php } ?> </div><!-- .vcex-img-flexslider-caption --> <?php } ?> </div><!-- .vcex-flexslider-entry-media --> </li><!-- .vcex-posttypes-slide --> <?php } ?> </ul><!-- .slides --> </div><!-- .flexslider --> </div><!-- .vcex-posttypes-flexslider --> <!-- Be safe and clear the floats --> <div class="vcex-clear-floats"></div> <?php // End has posts check } // Reset the WP query wp_reset_postdata(); // Return outbut buffer return ob_get_clean(); }
function vcex_blog_grid_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'term_slug' => '', 'include_categories' => '', 'exclude_categories' => '', 'posts_per_page' => '4', 'grid_style' => 'fit_columns', 'columns' => '3', 'order' => 'DESC', 'orderby' => 'date', 'filter' => 'false', 'masonry_layout_mode' => '', 'filter_speed' => '', 'center_filter' => '', 'thumbnail_link' => 'post', 'entry_media' => "true", 'img_width' => '9999', 'img_height' => '9999', 'thumb_link' => 'post', 'img_filter' => '', 'title' => 'true', 'date' => 'true', 'excerpt' => 'true', 'excerpt_length' => '15', 'custom_excerpt_trim' => 'true', 'read_more' => 'false', 'read_more_text' => __('read more', 'wpex'), 'pagination' => 'false', 'filter_content' => 'false', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'all_text' => __('All', 'wpex'), 'featured_video' => 'true', 'url_target' => '_self', 'date_color' => '', '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' => '', 'equal_heights_grid' => '', 'single_column_style' => ''), $atts)); // Turn output buffer on ob_start(); // Get global $post var 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, '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, 'category'); $filter_cats_exclude[] = $key->term_id; } $exclude_categories = array('taxonomy' => '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' => 'category', 'field' => 'slug', 'terms' => $include_categories, 'operator' => 'IN'); } else { $include_categories = ''; } // Pagination var $paged = NULL; $no_found_rows = true; if ('true' == $pagination) { global $paged; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $no_found_rows = false; } // The Query $wpex_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'paged' => $paged, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories), 'no_found_rows' => $no_found_rows)); //Output posts if ($wpex_query->posts) { // Custom excerpts trim $custom_excerpt_trim = 'true' == $custom_excerpt_trim ? true : false; // 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'); } // Display filter links if ($filter == 'true') { $terms = get_terms('category', array('include' => $filter_cats_include, 'exclude' => $filter_cats_exclude)); if ($terms && count($terms) > '1') { $center_filter = 'yes' == $center_filter ? 'center' : ''; ?> <ul class="vcex-blog-filter 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-blog-filter --> <?php } ?> <?php } // 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 . '"'; } // 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 . '"'; } } // Date design $date_style = ''; if ('true' == $date) { if ($date_color) { $date_style .= 'color:' . $date_color . ';'; } if ($date_style) { $date_style = 'style="' . $date_style . '"'; } } // Wrap classes $wrap_classes = 'wpex-row vcex-blog-grid clr'; if ($is_isotope) { $wrap_classes .= ' vcex-isotope-grid'; } if ('left_thumbs' == $single_column_style) { $wrap_classes .= ' left-thumbs'; } // Unique ID if ($unique_id) { $unique_id = ' id="' . $unique_id . '"'; } // Data $data = ''; if ($is_isotope && 'true' == $filter) { if ($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; ?> "<?php echo $unique_id . $data; ?> > <?php // Define counter var to clear floats $count = $count_all = ''; // Loop through posts 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 Vars $post_id = $post->ID; $format = get_post_format($post_id); $post_title = get_the_title(); $post_title_esc = esc_attr(the_title_attribute('echo=0')); $link = get_permalink(); // Counter $count++; // Link format tweaks if ('link' == $format) { $link = wpex_permalink(); $url_target = '_blank'; } // Get video if ('video' == $format) { $video_url = get_post_meta($post_id, 'wpex_post_oembed', true); } // Entry Classes $entry_classes = 'vcex-blog-entry col'; $entry_classes .= ' col-' . $count; $entry_classes .= ' span_1_of_' . $columns; if ($is_isotope) { $entry_classes .= ' vcex-isotope-entry'; } // Create a list of terms to add as classes to the entry if ($post_terms = get_the_terms($post, 'category')) { foreach ($post_terms as $post_term) { $entry_classes .= ' cat-' . $post_term->term_id; } } if ("false" == $entry_media) { $entry_classes .= ' vcex-blog-no-media-entry'; } ?> <article id="#post-<?php the_ID(); ?> " class="<?php echo $entry_classes; ?> "> <?php if ("true" == $entry_media) { ?> <?php $img_filter_class = $img_filter ? 'vcex-' . $img_filter : ''; ?> <?php if ("video" == $format && 'true' == $featured_video && $video_url) { ?> <div class="vcex-blog-entry-media"> <div class="vcex-video-wrap"> <?php echo wp_oembed_get($video_url); ?> </div> </div><!-- .vcex-blog-entry-media --> <?php } elseif (has_post_thumbnail()) { ?> <div class="vcex-blog-entry-media <?php echo $img_filter_class; ?> "> <?php if ($thumb_link == 'post' || $thumb_link == 'lightbox') { ?> <?php // Post links if ($thumb_link == 'post') { ?> <a href="<?php echo $link; ?> " title="<?php echo $post_title_esc; ?> " target="<?php echo $url_target; ?> "> <?php } ?> <?php // Lightbox Links if ($thumb_link == 'lightbox') { ?> <?php // Video Lightbox if ('video' == $format) { ?> <a href="<?php echo $video_url; ?> " title="<?php echo $post_title_esc; ?> " class="wpex-lightbox-video"> <?php } else { ?> <a href="<?php echo wp_get_attachment_url(get_post_thumbnail_id()); ?> " title="<?php echo $post_title_esc; ?> " class="wpex-lightbox"> <?php } ?> <?php } ?> <?php } // Get cropped image array and display image $cropped_img = wpex_image_resize(wp_get_attachment_url(get_post_thumbnail_id()), intval($img_width), intval($img_height), $img_crop, 'array'); ?> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php the_title(); ?> " class="vcex-blog-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> <?php if ($thumb_link == 'post' || $thumb_link == 'lightbox') { ?> </a> <?php } ?> </div><!-- .blog-entry-media --> <?php } ?> <?php } ?> <?php // Display entry details if the title or excerpt are enabled if ('true' == $title || 'true' == $excerpt) { ?> <div class="vcex-blog-entry-details clr" <?php echo $content_style; ?> > <?php // Equal height div if ($equal_heights_grid && !$is_isotope) { ?> <div class="match-height-content"> <?php } // Post Title if ($title == 'true') { ?> <h2 class="vcex-blog-entry-title" <?php echo $heading_style; ?> > <a href="<?php echo $link; ?> " title="<?php echo $post_title_esc; ?> " target="<?php echo $url_target; ?> " <?php echo $heading_style; ?> > <?php the_title(); ?> </a> </h2> <?php } // Post Date if ($date == 'true') { ?> <div class="vcex-blog-entry-date" <?php echo $date_style; ?> ><?php echo get_the_date(); ?> </div> <?php } // Excerpt if ('true' == $excerpt || 'true' == $read_more) { if ('true' != $excerpt) { $excerpt_length = '0'; } ?> <div class="vcex-blog-entry-excerpt clr"> <?php // Show full content if ('9999' == $excerpt_length) { the_content(); } else { // Custom Excerpt $excerpt_array = array('post_id' => $post_id, 'length' => intval($excerpt_length), 'trim_custom_excerpts' => $custom_excerpt_trim); vcex_excerpt($excerpt_array); } // Read more if ('true' == $read_more) { if ('link' == $format) { $read_more_text = __('Visit Website', 'wpex'); } ?> <a href="<?php echo $link; ?> " title="<?php echo $read_more_text; ?> " rel="bookmark" class="vcex-readmore theme-button" target="<?php echo $url_target; ?> " <?php echo $readmore_style; ?> > <?php echo $read_more_text; ?> <span class="vcex-readmore-rarr"><?php echo wpex_element('rarr'); ?> </span> </a> <?php } ?> </div> <?php } // Close Equal height div if ($equal_heights_grid && !$is_isotope) { ?> </div> <?php } ?> </div><!-- .blog-entry-details --> <?php } ?> </article><!-- .blog-entry --> <?php // Reset counter if ($count == $columns) { // Close equal height row if ($equal_heights_grid && !$is_isotope) { echo '</div><!-- .match-height-row -->'; } $count = '0'; } // 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-blog-grid --> <?php // Paginate Posts if ('true' == $pagination) { wpex_pagination($wpex_query); } // End has posts check } // Reset the WP query wp_reset_postdata(); // Return outbut buffer return ob_get_clean(); }
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(); }
function vcex_post_type_grid_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'post_types' => '', 'tax_query' => '', 'tax_query_taxonomy' => '', 'tax_query_terms' => '', 'posts_per_page' => '12', 'grid_style' => 'fit_columns', 'columns' => '3', 'order' => 'DESC', 'orderby' => 'date', 'orderby_meta_key' => '', 'filter' => '', 'masonry_layout_mode' => '', 'filter_speed' => '', 'center_filter' => '', 'thumbnail_link' => 'post', 'entry_media' => "true", 'img_width' => '9999', 'img_height' => '9999', 'thumb_link' => 'post', 'img_filter' => '', 'title' => 'true', 'date' => 'true', 'excerpt' => 'true', 'excerpt_length' => '15', 'custom_excerpt_trim' => 'true', 'read_more' => 'false', 'read_more_text' => __('read more', 'wpex'), 'pagination' => 'false', 'filter_content' => 'false', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'all_text' => __('All', 'wpex'), 'featured_video' => 'true', 'url_target' => '_self', 'thumbnail_query' => 'no', 'overlay_style' => '', 'img_hover_style' => '', 'date_color' => '', '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' => '', 'equal_heights_grid' => ''), $atts)); // Turn output buffer on ob_start(); // Get global $post var global $post; // 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; } // Post types $post_types = $post_types ? $post_types : 'post'; $post_types = explode(',', $post_types); $post_types_count = count($post_types); // Thumbnail meta query if ('true' == $thumbnail_query) { $meta_query = array(array('key' => '_thumbnail_id')); } else { $meta_query = NULL; } // Tax Query if ('' != $tax_query && '' != $tax_query_taxonomy && '' != $tax_query_terms) { $tax_query_terms = explode(',', $tax_query_terms); $tax_query = array(array('taxonomy' => $tax_query_taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms)); } else { $tax_query = ''; } // Query args $args = array('post_type' => $post_types, 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'tax_query' => $tax_query, 'meta_key' => $meta_key, 'filter_content' => $filter_content, 'paged' => $paged, 'meta_query' => $meta_query, 'no_found_rows' => $no_found_rows); // Build new query $wpex_query = new WP_Query($args); //Output posts if ($wpex_query->posts) { // Main Vars $unique_id = $unique_id ? $unique_id : 'post-type-' . rand(1, 100); $img_crop = $img_height == '9999' ? false : true; $read_more = $read_more == 'true' ? true : false; // Is Isotope var if ('true' == $filter && $post_types_count > '1' || 'masonry' == $grid_style || 'no_margins' == $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; } } // Main wrap classes $wrap_classes = 'wpex-row vcex-post-type-grid vcex-clearfix'; // Equal heights class if ('1' != $columns && ('fit_columns' == $grid_style && 'true' == $equal_heights_grid)) { $equal_heights_grid = true; } else { $equal_heights_grid = false; } // Isotope classes if ($is_isotope) { $wrap_classes .= ' vcex-isotope-grid'; } // No margins grid if ('no_margins' == $grid_style) { $wrap_classes .= ' vcex-no-margin-grid'; } // 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 . '"'; } // 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 . '"'; } } // Date design $date_style = ''; if ('true' == $date) { if ($date_color) { $date_style .= 'color:' . $date_color . ';'; } if ($date_style) { $date_style = 'style="' . $date_style . '"'; } } // Display filter links if ('true' == $filter && $post_types_count > '1') { $center_filter = 'yes' == $center_filter ? 'center' : ''; ?> <ul class="vcex-post-type-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 ($post_types as $post_type) { $obj = get_post_type_object($post_type); ?> <li><a href="#" data-filter=".post-type-<?php echo $post_type; ?> "><?php echo $obj->labels->name; ?> </a></li> <?php } ?> </ul><!-- .vcex-post-type-filter --> <?php } ?> <?php // Data $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 . '"'; } } if ('no_margins' == $grid_style && 'true' != $filter) { $data .= ' data-transition-duration="0.0"'; } ?> <div class="<?php echo $wrap_classes; ?> " id="<?php echo $unique_id; ?> "<?php echo $data; ?> > <?php // Define counter var to clear floats $count = $count_all = ''; // Loop through posts 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 ID var $post_id = $post->ID; // Add to counter var $count++; // Get post format $format = get_post_format($post_id); // Get video if ('true' == $featured_video) { $video_url = get_post_meta($post_id, 'wpex_post_oembed', true); } // General Class $entry_classes = 'vcex-post-type-entry col'; // Counter class $entry_classes .= ' col-' . $count; // Column class $entry_classes .= ' span_1_of_' . $columns; // Post type class $entry_classes .= ' post-type-' . get_post_type($post_id); // Isotope if ($is_isotope) { $entry_classes .= ' vcex-isotope-entry'; } // No margins grid if ('no_margins' == $grid_style) { $entry_classes .= ' vcex-no-margin-entry'; } // No media entry class if ("false" == $entry_media) { $entry_classes .= ' vcex-post-type-no-media-entry'; } if ($title == 'true') { $main_element_type = 'article'; } else { $main_element_type = 'div'; } ?> <<?php echo $main_element_type; ?> id="#post-<?php the_ID(); ?> " class="<?php echo $entry_classes; ?> "> <?php if ("true" == $entry_media) { ?> <?php // Video Embed if ("video" == $format && 'true' == $featured_video && $video_url) { ?> <div class="vcex-post-type-entry-media"> <div class="vcex-video-wrap"> <?php echo wp_oembed_get($video_url); ?> </div> </div><!-- .vcex-post-type-entry-media --> <?php } elseif (has_post_thumbnail()) { // Filter style $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 : ''; // Media classes $media_classes = $img_filter_class; $media_classes .= ' ' . $img_hover_style_class; $overlay_classnames = wpex_overlay_classname($overlay_style); $media_classes .= ' ' . $overlay_classnames; ?> <div class="vcex-post-type-entry-media <?php echo $media_classes; ?> "> <?php if ($thumb_link == 'post' || $thumb_link == 'lightbox') { ?> <?php // Post links if ($thumb_link == 'post') { ?> <a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> " target="<?php echo $url_target; ?> "> <?php } ?> <?php // Lightbox Links if ($thumb_link == 'lightbox') { ?> <?php // Video Lightbox if ($format == 'video') { ?> <a href="<?php echo $video_url; ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> " class="wpex-lightbox-video"> <?php } else { ?> <a href="<?php echo wp_get_attachment_url(get_post_thumbnail_id()); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> " class="wpex-lightbox"> <?php } ?> <?php } ?> <?php } // Get cropped image array and display image $cropped_img = wpex_image_resize(wp_get_attachment_url(get_post_thumbnail_id()), intval($img_width), intval($img_height), $img_crop, 'array'); ?> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php the_title(); ?> " class="vcex-post-type-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> <?php if ($thumb_link == 'post' || $thumb_link == 'lightbox') { ?> <?php } ?> <?php // Overlay if ('post' == $thumb_link || 'lightbox' == $thumb_link) { // Inner Overlay wpex_overlay('inside_link', $overlay_style); ?> </a> <?php // Outside Overlay wpex_overlay('outside_link', $overlay_style); } ?> </div><!-- .post_type-entry-media --> <?php } ?> <?php } ?> <?php if ('true' == $title || 'true' == $excerpt || 'true' == $read_more) { ?> <div class="vcex-post-type-entry-details clr" <?php echo $content_style; ?> > <?php // Equal height div if ($equal_heights_grid && !$is_isotope) { ?> <div class="match-height-content"> <?php } // Post Title if ('false' != $title) { ?> <h2 class="vcex-post-type-entry-title" <?php echo $heading_style; ?> > <a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> " target="<?php echo $url_target; ?> " <?php echo $heading_style; ?> ><?php the_title(); ?> </a> </h2> <?php } ?> <?php // Post Date if ($date == 'true') { ?> <div class="vcex-post-type-entry-date" <?php echo $date_style; ?> ><?php echo get_the_date(); ?> </div> <?php } ?> <?php // Excerpt if ('true' == $excerpt || 'true' == $read_more) { if ('true' != $excerpt) { $excerpt_length = '0'; } ?> <div class="vcex-post-type-entry-excerpt clr"> <?php // Show 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); } // Read more if ($read_more) { ?> <a href="<?php the_permalink(); ?> " title="<?php echo $read_more_text; ?> " rel="bookmark" class="vcex-readmore theme-button" target="<?php echo $url_target; ?> " <?php echo $readmore_style; ?> > <?php echo $read_more_text; ?> <span class="vcex-readmore-rarr"><?php echo wpex_element('rarr'); ?> </span> </a> <?php } ?> </div> <?php } // Close Equal height div if ($equal_heights_grid && !$is_isotope) { ?> </div> <?php } ?> </div><!-- .post_type-entry-details --> <?php } ?> </<?php echo $main_element_type; ?> ><!-- .post_type-entry --> <?php // Check if counter equal columns 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-post-type-grid --> <?php // Paginate Posts if ('true' == $pagination) { wpex_pagination($wpex_query); } // End has posts check } // Reset the WP query wp_reset_postdata(); // Return outbut buffer return ob_get_clean(); }
function vcex_testimonials_slider_shortcode($atts, $content = null) { extract(shortcode_atts(array('count' => '3', 'term_slug' => '', 'include_categories' => '', 'exclude_categories' => '', 'category' => 'all', 'order' => 'DESC', 'orderby' => 'date', 'skin' => 'light', 'font_size' => '', 'font_weight' => '', 'background' => '', 'background_image' => '', 'background_style' => 'stretch', 'css_animation' => '', 'filter_content' => 'false', 'excerpt' => 'false', 'excerpt_length' => '20', 'read_more' => 'true', 'read_more_text' => __('read more', 'wpex'), 'offset' => 0, 'unique_id' => '', 'slideshow' => 'true', 'slideshow_speed' => '7000', 'animation_speed' => '600', 'display_author_name' => 'false', 'display_author_avatar' => 'false', 'display_author_company' => 'false', 'padding_bottom' => '', 'padding_top' => '', 'custom_excerpt_trim' => ''), $atts)); // Turn output buffer on ob_start(); // Trim custom excerpts? if ('false' == $custom_excerpt_trim) { $custom_excerpt_trim = false; } else { $custom_excerpt_trim = true; } // Add Style $add_style = ''; if ($background) { $add_style .= 'background-color:' . $background . ';'; } if ($background_image) { $add_style .= 'background-image:url(' . wp_get_attachment_url($background_image) . ');'; } if ($padding_top) { $add_style .= 'padding-top:' . intval($padding_top) . 'px;'; } if ($padding_bottom) { $add_style .= 'padding-bottom:' . intval($padding_bottom) . 'px;'; } if ($add_style) { $add_style = ' style="' . $add_style . '"'; } // Slide Style $slide_style = array(); if ($font_size) { $slide_style[] = 'font-size: ' . $font_size . ';'; } if ($font_weight) { $slide_style[] = 'font-weight: ' . $font_weight . ';'; } $slide_style = implode('', $slide_style); if ($slide_style) { $slide_style = wp_kses($slide_style, array()); $slide_style = ' style="' . esc_attr($slide_style) . '"'; } // Get post meta to check page layout global $post; if ('full-screen' == get_post_meta($post->ID, 'wpex_post_layout', true)) { $inner_slide_container = 'container'; } else { $inner_slide_container = ''; } // 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, 'testimonials_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, 'testimonials_category'); $filter_cats_exclude[] = $key->term_id; } $exclude_categories = array('taxonomy' => 'testimonials_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' => 'testimonials_category', 'field' => 'slug', 'terms' => $include_categories, 'operator' => 'IN'); } else { $include_categories = ''; } // The Query $wpex_query = new WP_Query(array('post_type' => 'testimonials', 'posts_per_page' => $count, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'no_found_rows' => true, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories), 'no_found_rows' => true)); //Output posts if ($wpex_query->posts) { // Unique ID if ($unique_id) { $unique_id = 'id="' . $unique_id . '"'; } else { $unique_id = ''; } // Give flexslider a unique name $rand_num = rand(1, 100); $unique_flexslider_id = 'flexslider-' . $rand_num; ?> <script type="text/javascript"> jQuery(function($){ if ( $.fn.imagesLoaded != undefined && $.fn.flexslider != undefined ) { $(".vcex-flexslider-wrap").removeClass("flexslider-loader"); var $slider = $("#<?php echo $unique_flexslider_id; ?> "); $slider.imagesLoaded(function() { $slider.flexslider({ animation: "fade", slideshow : <?php echo $slideshow; ?> , slideshowSpeed: <?php echo $slideshow_speed; ?> , animationSpeed: <?php echo $animation_speed; ?> , controlNav : true, directionNav: false, pauseOnHover: true, smoothHeight: true, prevText : '<i class=icon-angle-left"></i>', nextText : '<i class="icon-angle-right"></i>', controlsContainer: ".vcex-slider-container-<?php echo $rand_num; ?> " }); }); } }); </script> <?php // Wrap classes $classes = 'vcex-testimonials-fullslider vcex-flexslider-wrap'; $classes .= ' vcex-slider-container-' . $rand_num; if ($skin) { $classes .= ' ' . $skin . '-skin'; } if ($background_style && $background_image) { $classes .= ' vcex-background-' . $background_style; } if ('' != $css_animation) { $classes .= ' wpb_animate_when_almost_visible wpb_' . $css_animation; } ?> <div class="<?php echo $classes; ?> "<?php echo $unique_id; echo $add_style; ?> > <div id="<?php echo $unique_flexslider_id; ?> " class="flexslider"> <ul class="slides"> <?php // Loop through posts foreach ($wpex_query->posts as $post) { setup_postdata($post); // Post VARS $post_id = $post->ID; $post_title = get_the_title($post_id); $post_content = $post->post_content; $author_name = get_post_meta($post_id, 'wpex_testimonial_author', true); // Testimonial start if ('' != $post_content) { ?> <li class="slide"> <div id="post-<?php echo $post_id; ?> " class="vcex-testimonials-fullslider-entry <?php echo $inner_slide_container; ?> " <?php echo $slide_style; ?> > <?php // Author avatar if ('yes' == $display_author_avatar && has_post_thumbnail($post_id)) { $post_thumb_id = get_post_thumbnail_id($post_id); $attachment_url = wp_get_attachment_url($post_thumb_id); if (function_exists('wpex_image_resize')) { $img_url = wpex_image_resize($attachment_url, '70', '70', true); } else { $img_url = $attachment_url; } ?> <div class="vcex-testimonials-fullslider-avatar"> <img src="<?php echo $img_url; ?> " alt="<?php echo $author_name; ?> " height="70" width="70" /> </div> <?php } // Custom Excerpt if ('true' == $excerpt) { if ('true' == $read_more) { $read_more_link = '...<a href="' . get_permalink() . '" title="' . $read_more_text . '">' . $read_more_text . '<span>→</span></a>'; } else { $read_more_link = '...'; } $excerpt_array = array('length' => intval($excerpt_length), 'trim_custom_excerpts' => $custom_excerpt_trim, 'post_id' => $post_id, 'more' => $read_more_link); vcex_excerpt($excerpt_array); } else { echo apply_filters('the_content', $post_content); } // Author name if ($author_name && 'yes' == $display_author_name) { $company = get_post_meta(get_the_ID(), 'wpex_testimonial_company', true); ?> <div class="vcex-testimonials-fullslider-author"> <?php echo $author_name; ?> <?php if ($company && 'true' == $display_author_company) { $company_url = get_post_meta(get_the_ID(), 'wpex_testimonial_url', true); if ($company_url) { ?> <a href="<?php echo esc_url($company_url); ?> " class="vcex-testimonials-fullslider-company" title="<?php echo $company; ?> " target="_blank"><?php echo $company; ?> </a> <?php } else { ?> <span class="vcex-testimonials-fullslider-company"><?php echo $company; ?> </span> <?php } } ?> </div> <?php } ?> </div><!-- .vcex-testimonials-fullslider-entry --> </li> <?php } ?> <?php } ?> </ul> </div> </div><!-- .vcex-testimonials-fullslider --><div class="vcex-clear-floats"></div> <?php } // End has posts check // Reset the WP query postdata wp_reset_postdata(); // Return outbut buffer return ob_get_clean(); }
function vcex_news_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'post_types' => '', 'term_slug' => 'all', 'include_categories' => '', 'exclude_categories' => '', 'count' => '12', 'grid_columns' => '1', 'order' => 'DESC', 'orderby' => 'date', 'header' => '', 'heading' => 'h3', 'date' => '', 'excerpt_length' => '15', 'read_more' => 'false', 'read_more_text' => __('read more', 'wpex'), 'filter_content' => 'false', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'css_animation' => '', 'img_width' => '9999', 'img_height' => '9999', 'featured_image' => 'false', 'featured_video' => 'true', 'pagination' => 'false', 'get_posts' => '', 'title' => '', 'title_size' => '', 'url_target' => '_self'), $atts)); // Turn output buffer on ob_start(); // Get global $post global $post; // Custom taxonomy only for standard posts if ('custom_post_types' != $get_posts) { // Post type $post_types = array('post'); // Include categories $include_categories = !empty($include_categories) ? $include_categories : $term_slug; $include_categories = 'all' == $include_categories ? '' : $include_categories; if ($include_categories) { $include_categories = explode(',', $include_categories); } // Exclude categories if ($exclude_categories) { $exclude_categories = explode(',', $exclude_categories); if (!empty($exclude_categories) && is_array($exclude_categories)) { $exclude_categories = array('taxonomy' => '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' => 'category', 'field' => 'slug', 'terms' => $include_categories, 'operator' => 'IN'); } else { $include_categories = ''; } } else { // Don't exclude categories for custom post type queries $include_categories = $exclude_categories = NULL; // Post Types $post_types = $post_types ? $post_types : 'post'; $post_types = explode(',', $post_types); } // Pagination var if ('true' == $pagination) { global $paged; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $no_found_rows = false; } else { $paged = NULL; $no_found_rows = true; } // The Query $vcex_query = new WP_Query(array('post_type' => $post_types, 'posts_per_page' => $count, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'no_found_rows' => $no_found_rows, 'paged' => $paged, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories, array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote'), 'operator' => 'NOT IN')))); $output = ''; //Output posts if ($vcex_query->posts) { $unique_id = $unique_id ? ' id="' . $unique_id . '"' : NULL; // CSS animations $classes = 'vcex-recent-news clr'; if ('1' != $grid_columns) { $classes .= ' wpex-row'; } if ('' != $css_animation) { $classes .= ' wpb_animate_when_almost_visible wpb_' . $css_animation . ''; } ?> <div class="<?php echo $classes; ?> " <?php echo $unique_id; ?> > <?php // Header if ('' != $header) { ?> <h2 class="vcex-recent-news-header theme-heading"> <span><?php echo $header; ?> </span> </h2> <?php } ?> <?php // Loop through posts $count = '0'; foreach ($vcex_query->posts as $post) { setup_postdata($post); $count++; // Post VARS $post_id = $post->ID; $url = get_permalink($post_id); $post_title = get_the_title($post_id); $post_excerpt = $post->post_excerpt; $post_content = $post->post_content; // Get post format $format = get_post_format($post_id); // Get post video if ('true' == $featured_video) { $post_video = get_post_meta($post_id, 'wpex_post_oembed', true); } // Get permalink $link = get_permalink(); // Link format tweaks if ('link' == $format) { $link = wpex_permalink(); $url_target = '_blank'; } // Image $featured_img_url = wp_get_attachment_url(get_post_thumbnail_id($post_id)); $img_width = $img_width ? intval($img_width) : '9999'; $img_height = $img_height ? intval($img_height) : '9999'; $img_crop = $img_height == '9999' ? false : true; $cropped_img = wpex_image_resize($featured_img_url, $img_width, $img_height, $img_crop, 'array'); ?> <?php // Extra rapper for recent news within columns if ($grid_columns > '1') { ?> <div class="col span_1_of_<?php echo $grid_columns; ?> vcex-recent-news-entry-wrap col-<?php echo $count; ?> "> <?php } // Entry classes $entry_classes = 'vcex-recent-news-entry clr'; if ('false' == $date) { $entry_classes .= ' no-left-padding'; } ?> <article class="<?php echo $entry_classes; ?> "> <?php // Date if ('false' != $date) { ?> <div class="vcex-recent-news-date"> <span class="day"> <?php echo get_the_time('d', $post_id); ?> </span> <span class="month"> <?php echo get_the_time('M', $post_id); ?> </span> </div> <?php } ?> <div class="vcex-news-entry-details clr"> <?php // Thumbnail if ('true' == $featured_image) { if ('video' == $format && 'true' == $featured_video && $post_video) { ?> <div class="vcex-news-entry-video vcex-video-wrap clr"> <?php echo wp_oembed_get($post_video); ?> </div> <?php } elseif (has_post_thumbnail($post_id)) { ?> <div class="vcex-news-entry-thumbnail clr"> <a href="<?php echo $link; ?> " title="<?php echo $post_title; ?> " target="<?php echo $url_target; ?> "> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php the_title(); ?> " class="vcex-recent-news-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> </a> </div> <?php } ?> <?php } ?> <?php // Display title unless disabled if ('false' != $title) { // Custom title font-size $inline_style = ''; if ($title_size) { $inline_style .= 'font-size:' . intval($title_size) . 'px;'; } if ($inline_style) { $inline_style = 'style="' . $inline_style . '"'; } ?> <header class="vcex-recent-news-entry-title"> <<?php echo $heading; ?> class="vcex-recent-news-entry-title-heading" <?php echo $inline_style; ?> > <a href="<?php echo $link; ?> " title="<?php $post_title; ?> " target="<?php echo $url_target; ?> "> <?php if ('link' == $format) { ?> <span><?php echo _x('Link', 'Link Format Title', 'wpex'); ?> : </span> <?php the_title(); ?> <?php } else { ?> <?php the_title(); ?> <?php } ?> </a> </<?php echo $heading; ?> > </header><!-- .vcex-recent-news-entry-title --> <?php } ?> <div class="vcex-recent-news-entry-excerpt vcex-clearfix"> <?php // Excerpts $read_more = $read_more == 'true' ? true : false; $excerpt_array = array('length' => intval($excerpt_length), 'readmore' => false); vcex_excerpt($excerpt_array); ?> <?php // Read more if ('true' == $read_more) { if ('link' == $format) { $read_more_text = __('Visit Website', 'wpex'); } ?> <a href="<?php echo $link; ?> " title="<?php echo $read_more_text; ?> " rel="bookmark" class="vcex-readmore theme-button" target="<?php echo $url_target; ?> "> <?php echo $read_more_text; ?> <span class="vcex-readmore-rarr">→</span> </a> <?php } ?> </div><!-- .vcex-recent-news-entry-excerpt --> </div><!-- .vcex-recent-news-entry-details --> </article><!-- .vcex-recent-news-entry --> <?php if ($grid_columns > '1') { ?> </div> <?php } // Reset counter if ($count == $grid_columns) { $count = ''; } // End foreach loop } ?> </div><!-- .vcex-recent-news --> <div class="vcex-recent-news-pagination clr"> <?php // Paginate Posts if ('true' == $pagination) { $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>')); } } ?> </div> <?php } // End has posts check // Set things back to normal wp_reset_postdata(); // Return data return ob_get_clean(); }