protected function content($atts, $content = null) { $this->content_has_container = false; // Get the shortcode atrributes extract(shortcode_atts(array('title' => '', 'layout' => 'posts', 'cat' => '', 'posts_per_page' => 6, 'column_count' => 3, 'column_count_tile' => 3, 'ac_order' => 'order_date_desc', 'order' => '', 'orderby' => '', 'show_title' => true, 'show_excerpt' => true, 'excerpt_length' => '', 'autoplay' => 'false', 'post__in' => '', 'offset' => '', 'show_cat_filter' => '', 'css_animation' => '', 'css' => '', 'show_read_more' => true), $atts)); // Ensure all data is in the correct format, as there might be differences between Visual Composer and WP Query // $post__in needs to be an array $post__in = trim($post__in); if ($post__in && !is_array($post__in)) { $post__in = explode(',', $post__in); $atts['post__in'] = $post__in; } // Merge in any plugin attributes. This gives us a single portable set of options $args = array('post_type' => $this->post_type, 'post_category' => $this->post_category, 'link_to_lightbox' => $this->link_to_lightbox, 'post_status' => 'publish'); // Expand the order by. Don't do this if post ids have been provided if ($ac_order && empty($post__in)) { // Order. Convert AC into WP $order = ac_convert_ac_order($ac_order); $atts['order'] = $order['order']; $atts['orderby'] = $order['orderby']; } // Merge the atrributes into the grid builder args $args = wp_parse_args($atts, $args); // Prepare args ac_prepare_args_for_get_posts($args); // Apple a filter based on the type $args = $this->filter_posts($args); // CSS $css_class = $this->build_outer_css($atts, $content); // Build the content $control = ''; // Standard - Posts if ($layout == 'posts') { $control = ac_posts_list($args); } elseif ($layout == 'grid' || $layout == 'masonry') { $control = ac_posts_grid($args); } elseif ($layout == 'carousel') { $control = $this->get_carousel($args); } elseif ($layout == 'slider') { if (!isset($args['slider_size'])) { $args['slider_size'] = '3by2'; // Default for image driver sliders } // Different style for some post types if ($this->post_type == 'attachment') { $args['slider_style'] = 'slider-gallery'; } elseif ($this->post_type == 'ac_testimonial') { $args['slider_style'] = 'no-caption'; $args['slider_size'] = 'auto-height'; // Clear meta_key, which we normally set for sliders to _thumbnail_id to ensure only sliders with featured images are shown $args['meta_key'] = null; $args['auto_height'] = true; // auto height as this is content lead and not image led } else { $args['slider_style'] = 'slider-post'; } $control = ac_render_posts_slideshow($args); } elseif ($layout == 'slick') { $control = ac_render_slick_carousel($args); } elseif ($layout == 'showcase') { $control = $this->get_showcase($args); } elseif ($layout == 'tile' || $layout == 'tile-masonry') { // Change the column count param $args['column_count'] = $args['column_count_tile']; $control = ac_posts_tile($args); } // Build the output $output = "\n\t" . '<div class="' . esc_attr($css_class) . ' ac-' . $layout . '-wrapper">'; $output .= "\n\t" . $this->get_title($title); $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= "\n\t\t\t" . $control; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment($this->settings['base']); return $output; }
<?php /***********************************/ /**** Gallery Archive Template ****/ /***********************************/ // Show the galleries as tiles $args = array('post_type' => 'ac_gallery', 'posts_per_page' => -1, 'column_count' => 4, 'layout' => 'tile', 'meta_key' => null, 'post__not_in' => ac_gallery_get_posts_to_ignore()); echo ac_posts_tile($args);