* @package WordPress * @subpackage Twenty_Fourteen * @since bt2n 1.0 */ ?> <div id="featured-content" class="featured-content"> <div class="featured-content-inner"> <?php /** * Fires before the bt2n featured content. * * @since bt2n 1.0 */ do_action('twentyfourteen_featured_posts_before'); $featured_posts = twentyfourteen_get_featured_posts(); foreach ((array) $featured_posts as $order => $post) { setup_postdata($post); // Include the featured content template. get_template_part('content', 'featured-post'); } /** * Fires after the bt2n featured content. * * @since bt2n 1.0 */ do_action('twentyfourteen_featured_posts_after'); wp_reset_postdata(); ?> </div><!-- .featured-content-inner --> </div><!-- #featured-content .featured-content -->
/** * A helper conditional function that returns a boolean value. * * @since Twenty Fourteen 1.0 * * @return bool Whether there are featured posts. */ function twentyfourteen_has_featured_posts() { return !is_paged() && (bool) twentyfourteen_get_featured_posts(); }
/** * Gets recent formatted posts that are not featured in FC plugin. * */ function twentyfourteen_get_recent($post_format) { $args = array('order' => 'DESC', 'ignore_sticky_posts' => 1, 'posts_per_page' => 2, 'tax_query' => array(array('taxonomy' => 'post_format', 'terms' => array($post_format), 'field' => 'slug', 'operator' => 'IN')), 'no_found_rows' => true); $featured_posts = twentyfourteen_get_featured_posts(); if (is_array($featured_posts) && !empty($featured_posts)) { $args['post__not_in'] = wp_list_pluck($featured_posts, 'ID'); } return new WP_Query($args); }