function vcex_portfolio_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', 'filter_content' => 'false', 'offset' => 0, '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, 'portfolio_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, 'portfolio_category'); $filter_cats_exclude[] = $key->term_id; } $exclude_categories = array('taxonomy' => 'portfolio_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' => 'portfolio_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' => 'portfolio', 'posts_per_page' => $count, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, '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-portfolio clr owl-carousel'; 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) { ?> <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 } ?> </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(); }
" title="<?php wpex_esc_title(); ?> " rel="bookmark"> <?php } ?> <?php echo $thumbnail; ?> <?php // Inside overlay HTML wpex_overlay('inside_link'); ?> <?php // Close link around staff item if enabled if (wpex_get_mod('staff_links_enable', true)) { echo '</a>'; } ?> <?php // Outside overlay HTML wpex_overlay('outside_link'); ?> </div><!-- .staff-entry-media -->
?> <?php // Inner link overlay html wpex_overlay('inside_link', $overlay_style, $atts); ?> </a> <?php } else { echo $image_output; } ?> <?php // Outside link overlay html wpex_overlay('outside_link', $overlay_style, $atts); ?> </div><!-- .wpex-carousel-entry-media --> <?php // Display details if ('yes' == $title && $attachment_title || 'yes' == $caption && $post->caption) { ?> <div class="wpex-carousel-entry-details clr"<?php echo $content_style; ?> > <?php
function vcex_portfolio_grid_shortcode($atts) { extract(shortcode_atts(array('unique_id' => '', 'term_slug' => '', 'include_categories' => '', 'exclude_categories' => '', 'posts_per_page' => '8', 'grid_style' => 'fit_columns', 'masonry_layout_mode' => '', 'filter_speed' => '', 'columns' => '4', 'order' => 'DESC', 'orderby' => 'date', 'orderby_meta_key' => '', 'filter' => '', 'center_filter' => 'no', 'thumb_link' => 'post', 'thumb_lightbox_gallery' => '', 'thumb_lightbox_title' => '', 'img_crop' => 'true', 'img_width' => '9999', 'img_height' => '9999', 'img_filter' => '', 'title' => 'true', 'title_link' => 'post', 'excerpt' => 'true', 'excerpt_length' => 30, 'custom_excerpt_trim' => '', 'read_more' => '', 'read_more_text' => __('read more', 'wpex'), 'pagination' => '', 'filter_content' => 'false', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'img_hover_style' => '', 'img_overlay_disable' => '', 'img_rendering' => '', 'all_text' => '', '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' => '', 'equal_heights_grid' => '', 'single_column_style' => '', 'entry_media' => ''), $atts)); // Turn output buffer on ob_start(); // Global $post global $post; // Don't create custom tax if tax doesn't exist if (taxonomy_exists('portfolio_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, 'portfolio_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, 'portfolio_category'); $filter_cats_exclude[] = $key->term_id; } $exclude_categories = array('taxonomy' => 'portfolio_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' => 'portfolio_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 variables $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' => 'portfolio', 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key, '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) { // Set unique ID $unique_id = $unique_id ? $unique_id : 'portfolio-' . rand(1, 100); // Image hard crop if ('9999' == $img_height) { $img_crop = false; } else { $img_crop = true; } // Is Isotope var if ('true' == $filter || '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; } } // 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 ('true' == $filter && taxonomy_exists('portfolio_category')) { // Get the terms for the filter $terms = get_terms('portfolio_category', array('include' => $filter_cats_include, 'exclude' => $filter_cats_exclude)); // Display filter only if terms exist and there is more then 1 if ($terms && count($terms) > '1') { // Center filter links $center_filter = 'yes' == $center_filter ? 'center' : ''; // All text if ($all_text) { $all_text = $all_text; } else { $all_text = __('All', 'wpex'); } ?> <ul class="vcex-portfolio-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-portfolio-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 ('false' != $read_more) { $read_more = 'true'; // Set readmore to true $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 . '"'; } } // Set title to true if not false if ('false' != $title) { $title = 'true'; } // Set excerpt to true if not false if ('false' != $excerpt) { $excerpt = 'true'; } // Default excerpt length if ('' == $excerpt_length) { $excerpt_length = '30'; } elseif ('false' == $excerpt) { $excerpt_length = '0'; } // Trim custom Excerpts? if ('false' == $custom_excerpt_trim) { $custom_excerpt_trim = false; } else { $custom_excerpt_trim = true; } // Only use articles if title is enabled for HTML5 validity if ($title == 'true') { $main_element_type = 'article'; } else { $main_element_type = 'div'; } // Main wrap classes $wrap_classes = 'wpex-row vcex-portfolio-grid clr'; // 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'; } // Left thumbnail 1 column style 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 $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 = ''; // 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_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 = 'portfolio-entry col'; $entry_classes .= ' span_1_of_' . $columns; $entry_classes .= ' col-' . $count; if ($is_isotope) { $entry_classes .= ' vcex-isotope-entry'; } if ('no_margins' == $grid_style) { $entry_classes .= ' vcex-no-margin-entry'; } if (taxonomy_exists('portfolio_category')) { $post_terms = get_the_terms($post, 'portfolio_category'); if ($post_terms) { foreach ($post_terms as $post_term) { $entry_classes .= ' cat-' . $post_term->term_id; } } } ?> <<?php echo $main_element_type; ?> class="<?php echo $entry_classes; ?> "> <?php // Entry Media if ('false' != $entry_media) { // Video if (function_exists('wpex_get_portfolio_featured_video_url') && wpex_get_portfolio_featured_video_url()) { ?> <div class="portfolio-entry-media clr"> <?php wpex_portfolio_post_video(); ?> </div> <?php } elseif (has_post_thumbnail()) { // Get cropped image $cropped_img = wpex_image_resize(wp_get_attachment_url(get_post_thumbnail_id()), intval($img_width), intval($img_height), $img_crop, 'array'); // Filter style $img_filter_class = $img_filter ? 'vcex-' . $img_filter : ''; // Media classes $media_classes = $img_filter_class; 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); } ?> <div class="portfolio-entry-media <?php echo $media_classes; ?> "> <?php // No link if ('nowhere' == $thumb_link) { ?> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php echo $post_title; ?> " class="portfolio-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> <?php // Lightbox } elseif ('lightbox' == $thumb_link) { // Display lightbox title $data = ''; if ('true' == $thumb_lightbox_title) { $data = ' data-title="' . $post_title_esc . '"'; } ?> <a href="<?php echo wp_get_attachment_url(get_post_thumbnail_id()); ?> " title="<?php echo $post_title_esc; ?> " class="portfolio-entry-media-link<?php echo $lightbox_single_class; ?> "<?php echo $data; ?> > <img src="<?php echo $cropped_img['url']; ?> " alt="<?php echo $post_title_esc; ?> " class="portfolio-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> <?php // Standarad post link } else { ?> <a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title_esc; ?> " class="portfolio-entry-media-link"> <img src="<?php echo $cropped_img['url']; ?> " alt="<?php echo $post_title_esc; ?> " class="portfolio-entry-img" height="<?php echo $cropped_img['height']; ?> " width="<?php echo $cropped_img['width']; ?> " /> <?php } ?> <?php // Close link and output overlay code if ('nowhere' != $thumb_link) { // Inner Overlay if ($overlay_style) { wpex_overlay('inside_link', $overlay_style); } // Close links echo '</a>'; // Outside Overlay if ($overlay_style) { wpex_overlay('outside_link', $overlay_style); } } ?> </div><!-- .portfolio-entry-media --> <?php } ?> <?php } ?> <?php // Display content if there is either a title or excerpt if ('true' == $title || 'true' == $excerpt) { ?> <div class="portfolio-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 ('false' != $title) { ?> <h2 class="portfolio-entry-title" <?php echo $heading_style; ?> > <?php // Link title to post if ('post' == $title_link) { ?> <a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title_esc; ?> " <?php echo $heading_style; ?> ><?php echo $post_title; ?> </a> <?php } elseif ('lightbox' == $title_link) { ?> <a href="<?php echo wp_get_attachment_url(get_post_thumbnail_id()); ?> " title="<?php echo $post_title_esc; ?> " class="wpex-lightbox" <?php echo $heading_style; ?> ><?php echo $post_title; ?> </a> <?php } else { echo $post_title; } ?> </h2> <?php } // Display excerpt and readmore if ('true' == $excerpt || 'true' == $read_more) { ?> <div class="portfolio-entry-excerpt clr"> <?php // Display full content if ('9999' == $excerpt_length) { the_content(); } elseif (function_exists('wpex_excerpt')) { $args = array('post_id' => $post_id, 'length' => intval($excerpt_length), 'trim_custom_excerpts' => $custom_excerpt_trim); wpex_excerpt($args); } else { the_excerpt(); } // Display Readmore if ('false' != $read_more) { // Read more string fallback if ('' == $read_more_text) { $read_more_text = __('read more', 'wpex'); } ?> <a href="<?php echo $post_permalink; ?> " title="<?php echo $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 } ?> </div> <?php } // Close Equal height div if ($equal_heights_grid && !$is_isotope) { ?> </div> <?php } ?> </div><!-- .portfolio-entry-details --> <?php } ?> </<?php echo $main_element_type; ?> ><!-- .portfolio-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-portfolio-grid --> <?php // Paginate Posts if ('true' == $pagination) { wpex_pagination($wpex_query); } // Reset the WP query wp_reset_postdata(); // End has posts check } // Return outbut buffer return ob_get_clean(); }
" title="<?php wpex_esc_title(); ?> " rel="bookmark" class="blog-entry-img-link<?php wpex_entry_image_animation_classes(); ?> "> <?php echo $thumbnail; ?> <?php if ($overlay) { ?> <?php wpex_overlay('inside_link', $overlay); ?> <?php } else { ?> <div class="blog-entry-music-icon-overlay"><span class="fa fa-music"></span></div> <?php } ?> </a><!-- .blog-entry-media-link --> <?php wpex_overlay('outside_link', $overlay); ?> </div><!-- .blog-entry-media --> <?php }
<?php } ?> <?php // Close link echo '</a><!-- .wpex-carousel-entry-img -->'; ?> <?php // Outside Overlay if ($overlay_style) { ?> <?php wpex_overlay('outside_link', $overlay_style); ?> <?php } ?> <?php } ?> </div><!-- .wpex-carousel-entry-media --> <?php } // Thumbnail check
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(); }