<div id="fw-gallery-grid" class="clearfix"> <?php $gallery_filter = vp_metabox('gallery_fw_page_settings.hb_gallery_filter'); $gallery_sorter = vp_metabox('gallery_fw_page_settings.hb_gallery_sorter'); $gallery_title = vp_metabox('gallery_fw_page_settings.hb_gallery_title'); $gallery_categories = vp_metabox('gallery_fw_page_settings.hb_gallery_categories'); $gallery_orientation = vp_metabox('gallery_fw_page_settings.hb_gallery_orientation'); $gallery_ratio = vp_metabox('gallery_fw_page_settings.hb_gallery_ratio'); $posts_per_page = vp_metabox('gallery_fw_page_settings.hb_gallery_posts_per_page'); if (!$posts_per_page) { $posts_per_page = -1; } $orderby = vp_metabox('gallery_fw_page_settings.hb_query_orderby'); $order = vp_metabox('gallery_fw_page_settings.hb_query_order'); $image_dimensions = get_image_dimensions($gallery_orientation, $gallery_ratio); if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } if (!empty($gallery_categories)) { $gallery_posts = new WP_Query(array('post_type' => 'gallery', 'posts_per_page' => $paged, 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'gallery_categories', 'field' => 'id', 'terms' => $gallery_categories, 'operator' => 'NOT IN')))); } else { $gallery_posts = new WP_Query(array('post_type' => 'gallery', 'posts_per_page' => $paged, 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish')); } $wp_query = $gallery_posts; ?>
<div class="hb-separator extra-space"><div class="hb-fw-separator"></div></div> <?php } ?> <?php $portfolio_filter = vp_metabox('portfolio_standard_page_settings.hb_gallery_filter'); $portfolio_sorter = vp_metabox('portfolio_standard_page_settings.hb_gallery_sorter'); $portfolio_categories = vp_metabox('portfolio_standard_page_settings.hb_gallery_categories'); $portfolio_orientation = vp_metabox('portfolio_standard_page_settings.hb_gallery_orientation'); $portfolio_ratio = vp_metabox('portfolio_standard_page_settings.hb_gallery_ratio'); $portfolio_columns_count = vp_metabox('portfolio_standard_page_settings.hb_gallery_columns'); if (!$portfolio_columns_count) { $portfolio_columns_count = 1; } $image_dimensions = get_image_dimensions($portfolio_orientation, $portfolio_ratio, 1000); global $wp_query; if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } if (!empty($portfolio_categories)) { $portfolio_posts = new WP_Query(array('post_type' => 'portfolio', 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $portfolio_categories, 'operator' => 'NOT IN')))); } else { $portfolio_posts = new WP_Query(array('post_type' => 'portfolio', 'orderby' => $orderby, 'paged' => $paged, 'order' => $order, 'posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish')); } $wp_query = $portfolio_posts; ?>
function hb_gallery_fullwidth_shortcode($params = array()) { extract(shortcode_atts(array('count' => '-1', 'columns' => '4', 'ratio' => 'ratio1', 'orientation' => 'landscape', 'category' => '', 'orderby' => 'date', 'order' => 'DESC', 'animation' => '', 'animation_delay' => '', 'class' => ''), $params)); if ($class != '') { $class = ' ' . $class; } if ($animation != '') { $animation = ' hb-animate-element ' . $animation; } if ($animation_delay != '') { // Remove ms or s, if entered in the attribute if (substr($height, -2) == 'ms') { $animation_delay = substr($height, 0, -2); } if (substr($height, -1) == 's') { $animation_delay = substr($height, 0, -1); } $animation_delay = ' data-delay="' . $animation_delay . '"'; } $output = ""; $image_dimensions = get_image_dimensions($orientation, $ratio, 1000); if ($category) { $category = str_replace(" ", "", $category); $category = explode(",", $category); $queried_items = new WP_Query(array('post_type' => 'gallery', 'orderby' => $orderby, 'order' => $order, 'status' => 'publish', 'posts_per_page' => $count, 'tax_query' => array(array('taxonomy' => 'gallery_categories', 'field' => 'slug', 'terms' => $category)))); } else { $queried_items = new WP_Query(array('post_type' => 'gallery', 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => $count, 'status' => 'publish')); } if ($queried_items->have_posts()) { $output .= '<div class="shortcode-wrapper shortcode-portfolio-fullwidth gallery-carousel-wrapper-2' . $class . $animation . '"' . $animation_delay . '>'; $output .= '<div class="fw-section without-border light-text">'; $output .= '<div class="content-total-fw">'; $output .= '<div class="hb-fw-elements columns-' . $columns . '">'; while ($queried_items->have_posts()) { $queried_items->the_post(); $thumb = get_post_thumbnail_id(); $image = hb_resize($thumb, '', $image_dimensions['width'], $image_dimensions['height'], true); $full_image = wp_get_attachment_image_src($thumb, 'full'); $gallery_attachments = rwmb_meta('hb_gallery_images', array('type' => 'plupload_image', 'size' => 'full'), get_the_ID()); $unique_id = rand(1, 10000); if (!$image && !empty($gallery_attachments)) { reset($gallery_attachments); $thumb = key($gallery_attachments); $image = hb_resize($thumb, '', $image_dimensions['width'], $image_dimensions['height'], true); $full_image = wp_get_attachment_image_src($thumb, 'full'); } $output .= '<div class="hb-fw-element">'; $output .= '<a href="' . $full_image[0] . '" rel="prettyPhoto[gallery_' . $unique_id . ']">'; if ($image) { $output .= '<img src="' . $image['url'] . '" width="' . $image['width'] . '" height="' . $image['height'] . '" alt="' . get_the_title() . '"/>'; } $output .= '<div class="item-overlay-text">'; $output .= '<div class="item-overlay-text-wrap">'; $output .= '<h4><span class="hb-gallery-item-name">' . get_the_title() . '</span></h4>'; $output .= '<div class="hb-small-separator"></div>'; $output .= '<span class="item-count-text">' . get_the_time('j M Y') . '</span>'; $output .= '</div>'; $output .= '</div>'; $output .= '</a>'; $output .= '</div>'; if (!empty($gallery_attachments)) { $output .= '<div class="hb-reveal-gallery">'; foreach ($gallery_attachments as $gal_id => $gal_att) { if ($gal_id != $thumb) { $output .= '<a href="' . $gal_att['url'] . '" title="' . $gal_att['description'] . '" rel="prettyPhoto[gallery_' . $unique_id . ']"></a>'; } } $output .= '</div>'; } } $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; } wp_reset_query(); return $output; }