function wpex_staff_column_class($query) { if ('related' == $query) { return wpex_grid_class(get_theme_mod('staff_related_columns', '3')); } else { return wpex_grid_class(get_theme_mod('staff_entry_columns', '3')); } }
function wpex_portfolio_column_class($query) { if ('related' == $query) { $columns = get_theme_mod('portfolio_related_columns', '4'); } else { $columns = get_theme_mod('portfolio_entry_columns', '4'); } return wpex_grid_class($columns); }
function woocommerce_product_classes($classes) { global $woocommerce_loop; if (isset($woocommerce_loop['columns'])) { $classes[] = 'col'; $classes[] = wpex_grid_class($woocommerce_loop['columns']); } return $classes; }
function wpex_post_entry_classes($classes) { // Post Data global $post; $post_id = $post->ID; $post_type = get_post_type($post_id); // Only add classes to standard post type if ($post_type !== 'post') { return $classes; } // Main vars $blog_style = 'large-image'; $grid_columns = 'span_1_of_2'; $admin_blog_style = wpex_option('blog_style', 'large-image'); $admin_grid_columns = wpex_option('blog_grid_columns', '2'); // Main Classes $classes[] = 'blog-entry clr'; // Blog Styles if (is_category()) { $term = get_query_var('cat'); $term_data = get_option("category_{$term}"); $term_style = ''; $grid_columns = ''; if ($term_data) { if (isset($term_data['wpex_term_style'])) { $term_style = $term_data['wpex_term_style'] !== '' ? $term_data['wpex_term_style'] . '' : ''; } if (isset($term_data['wpex_term_grid_cols'])) { $grid_columns = $term_data['wpex_term_grid_cols'] !== '' ? $term_data['wpex_term_grid_cols'] . '' : ''; } } $blog_style = $term_style !== '' ? $term_style . '-entry-style' : $admin_blog_style; $grid_columns = $grid_columns !== '' ? $grid_columns : $admin_grid_columns; } else { $blog_style = $admin_blog_style; $grid_columns = $admin_grid_columns; } // Add columns for grid style entries if ($blog_style == 'grid-entry-style') { $classes[] = wpex_grid_class($grid_columns); } // Return classes based on admin setting $classes[] = $blog_style; return $classes; }
<?php /** * This file contains the styling for Testimonial entries * * @package WordPress * @subpackage Total WordPress Theme */ ?> <?php global $wpex_count; $wpex_testimonial_author = get_post_meta(get_the_ID(), 'wpex_testimonial_author', true); $wpex_testimonial_company = get_post_meta(get_the_ID(), 'wpex_testimonial_company', true); $wpex_testimonial_url = get_post_meta(get_the_ID(), 'wpex_testimonial_url', true); $wpex_grid_class = wpex_grid_class(wpex_option('testimonials_entry_columns', '4')); ?> <article id="#post-<?php the_ID(); ?> " class="testimonial-entry col <?php echo $wpex_grid_class; ?> col-<?php echo $wpex_count; ?> "> <div class="testimonial-entry-content clr"> <span class="testimonial-caret"></span>
// Exit if accessed directly global $woocommerce_loop; // Store loop count we're currently on if (empty($woocommerce_loop['loop'])) { $woocommerce_loop['loop'] = 0; } // Store column count for displaying the grid if (empty($woocommerce_loop['columns'])) { $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 3); } // Increase loop count $woocommerce_loop['loop']++; ?> <li class="product-category <?php echo wpex_grid_class($woocommerce_loop['columns']); ?> col product<?php if (($woocommerce_loop['loop'] - 1) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1) { echo ' first'; } if ($woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0) { echo ' last'; } ?> "> <div class="product-category-inner clr"> <?php do_action('woocommerce_before_subcategory', $category); ?> <a href="<?php
} // Store column count for displaying the grid if (empty($woocommerce_loop['columns'])) { $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 4); } // Ensure visibility if (!$product || !$product->is_visible()) { return; } // Increase loop count $woocommerce_loop['loop']++; // Extra post classes $classes = array(); /** WPEX CLASSES **/ $classes[] = 'col'; $classes[] = wpex_grid_class($woocommerce_loop['columns']); /** WPEX CLASSES **/ // First column class if (0 == ($woocommerce_loop['loop'] - 1) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns']) { $classes[] = 'first'; } // Last column class if (0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns']) { $classes[] = 'last'; } // Get WooCommerce entry style from theme options $wpex_woo_style = get_theme_mod('woo_entry_style', 'two'); /****************************************************** * Woo Style 2 *****************************************************/ if ('two' == $wpex_woo_style) {
/** * Alter WooCommerce category classes * * @since 3.0.0 */ public static function product_cat_class($classes) { global $woocommerce_loop; $classes[] = 'col'; $classes[] = wpex_grid_class($woocommerce_loop['columns']); return $classes; }
* * @package Total WordPress theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Get counter & increase it global $wpex_count; // Add classes to the entry $classes = array(); $classes[] = 'testimonial-entry'; $classes[] = 'col'; $classes[] = wpex_grid_class(wpex_testimonials_archive_columns()); $classes[] = 'col-' . $wpex_count; ?> <article id="#post-<?php the_ID(); ?> " <?php post_class($classes); ?> > <?php get_template_part('partials/testimonials/testimonials-entry-content'); ?> <div class="testimonial-entry-bottom"> <?php
<?php /** * Used for your staff entries * * @package WordPress * @subpackage Total WordPress Theme */ // Counter for clearing floats and margins global $wpex_count; // Variable for adding correct css grid class to the staff-entry element $wpex_grid_class = wpex_grid_class(wpex_option('staff_entry_columns', '4')); ?> <?php if (has_post_thumbnail()) { ?> <article id="#post-<?php the_ID(); ?> " class="staff-entry col <?php echo $wpex_grid_class; ?> col-<?php echo $wpex_count; ?> "> <div class="staff-entry-media"> <?php if (wpex_option('staff_links_enable', '1') == '1') { ?>
function wpex_post_gallery($output, $attr) { // load scripts global $post, $wp_locale; static $instance = 0; $instance++; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'columns' => 3, 'include' => '', 'exclude' => '', 'img_height' => '', 'img_width' => ''), $attr)); $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => '', 'inherit' => '', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id => $attachment) { $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; } return $output; } // Define important vars $columns = intval($columns); $float = is_rtl() ? 'right' : 'left'; $output = apply_filters('gallery_style', '<div id="gallery-' . $instance . '" class="gallery galleryid-' . $id . ' wpex-gallery wpex-gallery-lightbox clr">'); // Begin Loop $gallery_id = $id; $count = 0; foreach ($attachments as $id => $attachment) { $count++; // Set vars to remove margin on last item of each row and clear floats if ($count == $columns) { $count = 0; } // Full image url $full_img = wp_get_attachment_url($id); // Set image cropping sizes if ($img_width == '') { $img_width = wpex_option('gallery_image_width', '400'); } if ($img_height == '') { $img_height = wpex_option('gallery_image_height', '340'); } // Set correct cropping sizes if ($columns > 1) { $img_url = aq_resize($full_img, $img_width, $img_height, true); } else { $img_url = wp_get_attachment_url($id); } // Start Gallery Item $output .= '<div class="gallery-item ' . wpex_grid_class($columns) . ' col col-' . $count . '">'; // Display image $output .= ' <div class="gallery-icon"> <a href="' . $full_img . '" title="' . $attachment->post_excerpt . '"> <img src="' . $img_url . '" alt="' . $attachment->post_excerpt . '" /> </a> </div><!-- /gallery-icon -->'; // Show caption if there is one if (trim($attachment->post_excerpt)) { $output .= '<div class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</div><!-- /gallery-caption -->'; } // Clear floats and close gallery item div $output .= "</div><!-- /gallery-item -->"; } // Clear floats and close gallery div $output .= "</div><!-- /gallery-{$instance} -->\n"; return $output; }
<?php /** * Footer bottom content * * @package Total WordPress Theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Get footer widgets columns $columns = wpex_get_mod('footer_widgets_columns', '4'); $grid_class = wpex_grid_class($columns); $gap = wpex_get_mod('footer_widgets_gap', '30'); // Classes $wrap_classes = array('clr'); if ('1' == $columns) { $wrap_classes[] = 'single-col-footer'; } if ($gap) { $wrap_classes[] = 'gap-' . $gap; } $wrap_classes = implode(' ', $wrap_classes); ?> <div id="footer-widgets" class="wpex-row <?php echo $wrap_classes; ?>
foreach ($wpex_related_query->posts as $post) { setup_postdata($post); // Add row for equal heights if (0 == $count && $has_excerpt) { ?> <div class="match-height-row clr"> <?php } // Increase counter by 1 for each post $count++; $count_all++; // Define post ID $post_id = $post->ID; ?> <article class="related-post clr col <?php echo wpex_grid_class($columns); ?> col-<?php echo $count; ?> "> <?php // Display related post thumbnail if (has_post_thumbnail($post_id)) { $image = wpex_image('array', '', true); ?> <a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(the_title_attribute('echo=0'));
*/ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Disable embeds $show_embeds = apply_filters('wpex_related_blog_posts_embeds', false); // Check if experts are enabled $has_excerpt = wpex_get_mod('blog_related_excerpt', true); // Get post format $format = get_post_format(); // Get featured image $thumbnail = wpex_get_post_thumbnail(array('size' => 'blog_related')); // Add classes $classes = array('related-post', 'clr', 'nr-col'); $classes[] = wpex_grid_class($wpex_columns); $classes[] = 'col-' . $wpex_count; ?> <article <?php post_class($classes); ?> > <?php // Display post video if ($show_embeds && 'video' == $format && ($video = wpex_get_post_video_html())) { ?> <div class="related-post-video"> <?php
/** * Tweaks the default WP Gallery Output * * @since 1.0.0 */ public static function output($output, $attr) { // Main Variables global $post, $wp_locale, $instance; $instance++; static $instance = 0; $output = ''; // Sanitize orderby statement if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } // Get shortcode attributes extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'columns' => 3, 'include' => '', 'exclude' => '', 'img_height' => '', 'img_width' => '', 'size' => '', 'crop' => ''), $attr)); // Get post ID $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => '', 'inherit' => '', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; $size = $size ? $size : 'thumbnail'; foreach ($attachments as $attachment_id => $attachment) { $output .= wp_get_attachment_link($attachment_id, $size, true) . "\n"; } return $output; } // Get columns # $columns = intval($columns); // Set cropping sizes if ($columns > 1) { $img_width = $img_width ? $img_width : wpex_get_mod('gallery_image_width'); $img_height = $img_height ? $img_height : wpex_get_mod('gallery_image_height'); } // Sanitize Data $size = $size ? $size : 'large'; $size = $img_width || $img_height ? 'wpex_custom' : $size; $crop = $crop ? $crop : 'center-center'; // Float $float = is_rtl() ? 'right' : 'left'; // Load lightbox skin stylesheet wpex_enqueue_ilightbox_skin(); // Begin output $output .= '<div id="gallery-' . $instance . '" class="wpex-gallery wpex-row lightbox-group clr">'; // Begin Loop $count = 0; foreach ($attachments as $attachment_id => $attachment) { // Increase counter for clearing floats $count++; // Attachment Vars $attachment_data = wpex_get_attachment_data($attachment_id); $alt = $attachment_data['alt']; $caption = $attachment_data['caption']; $video = $attachment_data['video']; $lightbox_url = $video ? $video : wpex_get_lightbox_image($attachment_id); // Generate the image HTMl $img_html = wpex_get_post_thumbnail(array('attachment' => $attachment_id, 'size' => $size, 'width' => $img_width, 'height' => $img_height, 'crop' => $crop)); // Add data attributes for lightbox if ($video) { $lightbox_data = ' data-options="thumbnail: \'' . wpex_get_lightbox_image($attachment_id) . '\', width:1920, height:1080"'; } else { $lightbox_data = ' data-type="image"'; } // Start Gallery Item $output .= '<figure class="gallery-item ' . wpex_grid_class($columns) . ' col col-' . $count . '">'; // Display image $output .= '<a href="' . $lightbox_url . '" title="' . wp_strip_all_tags($caption) . '" class="wpex-lightbox-group-item"' . $lightbox_data . '>'; $output .= $img_html; $output .= '</a>'; // Display Caption if (trim($attachment->post_excerpt)) { if (wpex_is_front_end_composer()) { $output .= '<div class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</div>'; } else { $output .= '<figcaption class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</figcaption>'; } } // Close gallery item div $output .= "</figure>"; // Set vars to remove margin on last item of each row and clear floats if ($count == $columns) { $count = '0'; } } // Close gallery div $output .= "</div>\n"; return $output; }
<?php /** * Used for your portfolio entries * See single-portfolio.php for single post layout * * @package WordPress * @subpackage Total WordPress Theme */ // Counter for clearing floats and margins global $wpex_count; // Variable for adding correct css grid class to the portfolio-entry element $wpex_grid_class = wpex_grid_class(wpex_option('portfolio_entry_columns', '4')); ?> <article id="#post-<?php the_ID(); ?> " class="portfolio-entry col <?php echo $wpex_grid_class; ?> col-<?php echo $wpex_count; ?> "> <?php // Media wrap if post has thumbnail if (has_post_thumbnail()) { ?> <div class="portfolio-entry-media"> <a href="<?php
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { // Parse instance extract(wp_parse_args($instance, $this->defaults)); $img_hover_classes = wpex_image_hover_classes($img_hover); // Apply filters to the title $title = apply_filters('widget_title', $title, $instance, $this->id_base); // Before widget WP hook echo $args['before_widget']; // Display title if defined if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="wpex-recent-posts-thumb-grid wpex-row clr"> <?php // Query args $query_args = array('post_type' => $post_type, 'posts_per_page' => $number, 'meta_key' => '_thumbnail_id', 'no_found_rows' => true); // Order params - needs FALLBACK don't ever edit! if (!empty($orderby)) { $query_args['order'] = $order; $query_args['orderby'] = $orderby; } else { $query_args['orderby'] = $order; // THIS IS THE FALLBACK } // Taxonomy args if (!empty($taxonomy) && !empty($terms)) { // Sanitize terms and convert to array $terms = str_replace(', ', ',', $terms); $terms = explode(',', $terms); // Add to query arg $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $terms)); } // Exclude current post if (is_singular()) { $query_args['post__not_in'] = array(get_the_ID()); } // Query posts $wpex_query = new WP_Query($query_args); // Set post counter variable $count = 0; // Loop through posts while ($wpex_query->have_posts()) { $wpex_query->the_post(); ?> <?php // Add to counter variable $count++; ?> <li class="<?php echo wpex_grid_class($columns); ?> nr-col col-<?php echo esc_attr($count); ?> "> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> "<?php if ($img_hover_classes) { echo ' class="' . esc_attr($img_hover_classes) . '"'; } ?> > <?php wpex_post_thumbnail(array('size' => $img_size, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); ?> </a> </li> <?php // Reset counter to clear floats if ($count == $columns) { $count = '0'; } ?> <?php // End loop } ?> <?php // Reset global query post data wp_reset_postdata(); ?> </ul> <?php // After widget WP hook echo $args['after_widget']; ?> <?php }
/** * Returns correct blog entry classes * * @since 1.1.6 */ function wpex_blog_entry_classes() { // Define classes array $classes = array(); // Entry Style $entry_style = wpex_blog_entry_style(); // Core classes $classes[] = 'blog-entry'; $classes[] = 'clr'; // Masonry classes if ('masonry' == wpex_blog_grid_style()) { $classes[] = 'isotope-entry'; } // Equal heights if (wpex_blog_entry_equal_heights()) { $classes[] = 'blog-entry-equal-heights'; } // Add columns for grid style entries if ($entry_style == 'grid-entry-style') { $classes[] = 'col'; $classes[] = wpex_grid_class(wpex_blog_entry_columns()); } // No Featured Image Class, don't add if oembed or self hosted meta are defined if (!has_post_thumbnail() && '' == get_post_meta(get_the_ID(), 'wpex_post_self_hosted_shortcode', true) && '' == get_post_meta(get_the_ID(), 'wpex_post_oembed', true)) { $classes[] = 'no-featured-image'; } // Blog entry style $classes[] = $entry_style; // Avatar if ($avatar_enabled = wpex_get_mod('blog_entry_author_avatar')) { $classes[] = 'entry-has-avatar'; } // Counter global $wpex_count; if ($wpex_count) { $classes[] = 'col-' . $wpex_count; } // Apply filters to entry post class for child theming $classes = apply_filters('wpex_blog_entry_classes', $classes); // Rturn classes array return $classes; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ function widget($args, $instance) { // Set vars for widget usage $title = isset($instance['title']) ? $instance['title'] : ''; $title = apply_filters('widget_title', $title); $post_type = isset($instance['post_type']) ? $instance['post_type'] : ''; $taxonomy = isset($instance['taxonomy']) ? $instance['taxonomy'] : ''; $terms = isset($instance['terms']) ? $instance['terms'] : ''; $number = isset($instance['number']) ? $instance['number'] : ''; $order = isset($instance['order']) ? $instance['order'] : ''; $columns = isset($instance['columns']) ? $instance['columns'] : '3'; $img_hover = isset($instance['img_hover']) ? $instance['img_hover'] : ''; $img_size = isset($instance['img_size']) ? $instance['img_size'] : 'wpex_custom'; $img_height = !empty($instance['img_height']) ? intval($instance['img_height']) : ''; $img_width = !empty($instance['img_width']) ? intval($instance['img_width']) : ''; $img_size = $img_width || $img_height ? 'wpex_custom' : $img_size; $exclude = is_singular() ? array(get_the_ID()) : NULL; // Sanitize terms if ($terms) { $terms = str_replace(', ', ',', $terms); $terms = explode(',', $terms); } // Before widget WP hook echo $args['before_widget']; // Display title if defined if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="wpex-recent-posts-thumb-grid wpex-row clr"> <?php // Query args $query_args = array('post_type' => $post_type, 'posts_per_page' => $number, 'orderby' => $order, 'meta_key' => '_thumbnail_id', 'post__not_in' => $exclude, 'no_found_rows' => true); // Taxonomy args if (!empty($taxonomy) && !empty($terms)) { $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $terms)); } // Query posts $my_query = new WP_Query($query_args); ?> <?php // Set post counter variable $count = 0; ?> <?php // Loop through posts while ($my_query->have_posts()) { $my_query->the_post(); ?> <?php // Add to counter variable $count++; ?> <?php // Get post thumbnail $thumbnail = wpex_get_post_thumbnail(array('size' => $img_size, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); ?> <?php // Get hover classes if ($img_hover) { $hover_classes = ' class="' . wpex_image_hover_classes($img_hover) . '"'; } else { $hover_classes = ''; } ?> <li class="<?php echo wpex_grid_class($columns); ?> nr-col col-<?php echo $count; ?> "> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> "<?php echo $hover_classes; ?> ><?php echo $thumbnail; ?> </a> </li> <?php // Reset counter to clear floats if ($count == $columns) { $count = '0'; } ?> <?php // End loop } ?> <?php // Reset global query post data wp_reset_postdata(); ?> </ul> <?php // After widget WP hook echo $args['after_widget']; ?> <?php }
exit; } // Get counter & increase it global $wpex_count; $wpex_count++; // Testimonial data $post_id = get_the_ID(); $author = get_post_meta($post_id, 'wpex_testimonial_author', true); $company = get_post_meta($post_id, 'wpex_testimonial_company', true); $company_url = get_post_meta($post_id, 'wpex_testimonial_url', true); $wpex_image = wpex_image('array'); // Add classes to the entry $classes = array(); $classes[] = 'testimonial-entry'; $classes[] = 'col'; $classes[] = wpex_grid_class(get_theme_mod('testimonials_entry_columns', '4')); $classes[] = 'col-' . $wpex_count; ?> <article id="#post-<?php the_ID(); ?> " <?php post_class($classes); ?> > <div class="testimonial-entry-content clr"> <span class="testimonial-caret"></span> <?php the_content(); ?>
/** * Tweaks the default WP Gallery Output * * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/post_gallery * @since 1.0.0 */ function output($output, $attr) { // Main Variables global $post, $wp_locale; static $instance = 0; $instance++; $output = ''; // Sanitize orderby statement if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } // Get shortcode attributes extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'columns' => 3, 'include' => '', 'exclude' => '', 'img_height' => '', 'img_width' => '', 'size' => 'medium'), $attr)); // Get post ID $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => '', 'inherit' => '', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; foreach ($attachments as $attachment_id => $attachment) { $output .= wp_get_attachment_link($attachment_id, $size, true) . "\n"; } return $output; } // Get columns # $columns = intval($columns); // Float $float = is_rtl() ? 'right' : 'left'; $output .= '<div id="gallery-' . $instance . '" class="wpex-gallery wpex-row lightbox-group clr">'; // Begin Loop $count = 0; foreach ($attachments as $attachment_id => $attachment) { // Increase counter for clearing floats $count++; // Attachment Vars $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); $caption = $attachment->post_excerpt; $full_img = wp_get_attachment_url($attachment_id); // Crop images using built-in function if enabled if (get_theme_mod('wpex_image_resizer', true)) { // Set cropping sizes if (!$img_width) { $img_width = get_theme_mod('gallery_image_width', '300'); } if (!$img_height) { $img_height = get_theme_mod('gallery_image_height', '300'); } // Set hard crop if ('9999' == $img_height) { $img_crop = false; } else { $img_crop = true; } // Set correct cropping sizes if ($columns > 1) { $img_url = wpex_image_resize($full_img, $img_width, $img_height, $img_crop); } else { $img_url = wp_get_attachment_url($attachment_id); } } else { if ('1' == $columns) { $size = 'large'; } elseif ($columns >= '4') { $size = 'thumbnail'; } $img_url = wp_get_attachment_image_src($attachment_id, $size, false); $img_url = $img_url[0]; } // Start Gallery Item $output .= '<figure class="gallery-item ' . wpex_grid_class($columns) . ' col col-' . $count . '">'; // Display image $output .= '<a href="' . $full_img . '" title="' . wp_strip_all_tags($caption) . '" class="lightbox-group-item"> <img src="' . $img_url . '" alt="' . $alt . '" /> </a>'; // Display Caption if (trim($attachment->post_excerpt)) { $output .= '<figcaption class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</figcaption>'; } // Close gallery item div $output .= "</figure>"; // Set vars to remove margin on last item of each row and clear floats if ($count == $columns) { $count = '0'; } } // Close gallery div $output .= "</div>\n"; return $output; }
</div><!-- .footer-one-box --> <div class="footer-box <?php echo wpex_grid_class(wpex_option('footer_col', '3')); ?> col <?php if (wpex_option('footer_col') == '2') { echo 'col-1'; } ?> col-3 "> <?php dynamic_sidebar('footer_three'); ?> </div><!-- .footer-one-box --> <div class="footer-box <?php echo wpex_grid_class(wpex_option('footer_col', '3')); ?> col <?php if (wpex_option('footer_col') == '3') { echo 'col-1'; } ?> col-4"> <?php dynamic_sidebar('footer_four'); ?> </div><!-- .footer-box --> </div><!-- #footer-widgets --> </footer><!-- #footer --> <?php