/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { if (isset($atts['link'])) { $atts['link'] = explode(',', $atts['link'], 2); $atts['taxonomy'] = $atts['link'][0]; if (isset($atts['link'][1])) { $atts['categories'] = $atts['link'][1]; } } $atts['class'] = $meta['el_class']; $slider = new avia_post_slider($atts); $slider->query_entries(); return $slider->html(); }
/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { global $avia_config; if (empty($atts['categories'])) { $atts['categories'] = ""; } if (isset($atts['link']) && isset($atts['blog_type']) && $atts['blog_type'] == 'taxonomy') { $atts['link'] = explode(',', $atts['link'], 2); $atts['taxonomy'] = $atts['link'][0]; if (!empty($atts['link'][1])) { $atts['categories'] = $atts['link'][1]; } else { if (!empty($atts['taxonomy'])) { $taxonomy_terms_obj = get_terms($atts['taxonomy']); foreach ($taxonomy_terms_obj as $taxonomy_term) { $atts['categories'] .= $taxonomy_term->term_id . ','; } } } } $atts = shortcode_atts(array('blog_style' => '', 'columns' => 3, 'blog_type' => 'posts', 'items' => '16', 'paginate' => 'yes', 'categories' => '', 'preview_mode' => 'auto', 'image_size' => 'portfolio', 'post_type' => 'post', 'taxonomy' => 'category', 'contents' => 'excerpt', 'content_length' => 'content', 'offset' => '0'), $atts); if ($atts['blog_style'] == "blog-grid") { $atts['class'] = $meta['el_class']; $atts['type'] = 'grid'; //using the post slider with inactive js will result in displaying a nice post grid $slider = new avia_post_slider($atts); $slider->query_entries(); return $slider->html(); } $this->query_entries($atts); $avia_config['blog_style'] = $atts['blog_style']; $avia_config['preview_mode'] = $atts['preview_mode']; $avia_config['image_size'] = $atts['image_size']; $avia_config['blog_content'] = $atts['content_length']; $avia_config['remove_pagination'] = $atts['paginate'] === "yes" ? false : true; $more = 0; ob_start(); //start buffering the output instead of echoing it get_template_part('includes/loop', 'index'); $output = ob_get_clean(); wp_reset_query(); avia_set_layout_array(); if ($output) { $output = "<div class='template-blog'>{$output}</div>"; } return $output; }
<div class='container template-blog '> <div class='content <?php avia_layout_class('content'); ?> units'> <?php if (avia_get_option('blog_style', 'multi-big') == 'blog-grid') { global $posts; $post_ids = array(); foreach ($posts as $post) { $post_ids[] = $post->ID; } $atts = array('type' => 'grid', 'items' => get_option('posts_per_page'), 'columns' => 3, 'class' => 'avia-builder-el-no-sibling', 'paginate' => 'yes', 'use_main_query_pagination' => 'yes', 'custom_query' => array('post__in' => $post_ids, 'post_type' => get_post_types())); $blog = new avia_post_slider($atts); $blog->query_entries(); echo "<div class='entry-content'>" . $blog->html() . "</div>"; } else { /* Run the loop to output the posts. * If you want to overload this in a child theme then include a file * called loop-index.php and that will be used instead. */ $more = 0; get_template_part('includes/loop', 'index'); } ?> <!--end content--> </div>
$post_ids[] = $post->ID; } if (!empty($post_ids)) { echo "<div class='entry-content-wrapper'>"; foreach ($sorted as $key => $post_type) { if (empty($post_type)) { continue; } if (isset($post_type_obj[$key]->labels->name)) { $label = apply_filters('avf_tag_label_names', $post_type_obj[$key]->labels->name); $output .= "<h3 class='post-title tag-page-post-type-title'>" . $label . "</h3>"; } else { $output .= "<hr />"; } $atts = array('type' => 'grid', 'items' => get_option('posts_per_page'), 'columns' => 3, 'class' => 'avia-builder-el-no-sibling', 'paginate' => 'yes', 'use_main_query_pagination' => 'yes', 'custom_query' => array('post__in' => $post_ids, 'post_type' => $key)); $blog = new avia_post_slider($atts); $blog->query_entries(); $output .= $blog->html(); } echo $output; echo '</div>'; } else { get_template_part('includes/loop', 'index'); } } else { foreach ($sorted as $key => $post_type) { if (empty($post_type)) { continue; } if (isset($post_type_obj[$key]->labels->name)) { $label = apply_filters('avf_tag_label_names', $post_type_obj[$key]->labels->name);