<?php /** * Shortcode "Recent Posts" output * * @since 1.0.0 * * @author 8guild * @package Appica * @subpackage Core */ $a = shortcode_atts(array('per_page' => '', 'is_excerpt' => '', 'img_size' => '', 'extra_class' => ''), $atts); $per_page = 'all' === $a['per_page'] ? -1 : absint($a['per_page']); $is_excerpt = 'yes' === $a['is_excerpt']; $img_size = Appica_Helpers::get_image_size($a['img_size']); $classes = Appica_Helpers::get_class_set(array('scroller', 'posts', $a['extra_class'])); $query = new WP_Query(array('posts_per_page' => $per_page, 'post_status' => 'publish', 'ignore_sticky_posts' => true)); /* * Start output */ if ($query->have_posts()) { printf('<div class="%1$s">', $classes); /** * Add the temporary filter to change the excerpt length. * Not need in other places, so filter will be removed after WP_Query Loop. * * @since 1.0.0 */ add_filter('excerpt_length', array('Appica_Filters', 'excerpt_length')); /** * Temporary filter to trim the length of excerpt, if custom excerpt specified.