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; }
switch ($archive_post_style) { case 'grid': case 'masonry': // We need the category for the post type for the grid filter to work $post_category = ''; // Get them all $taxonomy_names = array(); if (isset($wp_query->query['post_type'])) { $taxonomy_names = get_object_taxonomies($wp_query->query['post_type']); } if (count($taxonomy_names) > 0) { $post_category = $taxonomy_names[0]; } // Build the args for the grid $args = array('layout' => $archive_post_style, 'post_category' => $post_category, 'show_cat_filter' => true, 'column_count' => $archive_grid_cols); echo ac_posts_grid($args, $wp_query->posts); break; default: break; } } else { // If no content, include the "No posts found" template. get_template_part('templates/list-no_results', 'archive'); } } else { if (have_posts()) { while (have_posts()) { the_post(); do_action('shoestrap_before_the_content'); // AC - Load the content template based on post-type and post-format ac_load_post_content();
<?php /************************************/ /**** Related Projects Template ****/ /************************************/ $related_posts = ac_portfolio_get_related(); if (count($related_posts)) { ?> <section class='related-projects'> <h3 class='title uppercase margin-bottom-medium'><strong>Related Projects</strong></h3> <?php $args = array('column_count' => 3, 'show_excerpt' => false, 'image_aspect_ratio' => AC_IMAGE_RATIO_3BY2); echo ac_posts_grid($args, $related_posts); ?> </section> <?php } // related posts ?>