/** * Ignore and exclude featured posts on the home page. */ function expound_pre_get_posts($query) { if (!$query->is_main_query() || is_admin()) { return; } if ($query->is_home()) { // condition should be (almost) the same as in index.php $query->set('ignore_sticky_posts', true); $exclude_ids = array(); $featured_posts = expound_get_featured_posts(); if ($featured_posts->have_posts()) { foreach ($featured_posts->posts as $post) { $exclude_ids[] = $post->ID; } } $query->set('post__not_in', $exclude_ids); } }
<?php /** * @package Expound */ $featured_posts = expound_get_featured_posts(); if ($featured_posts->have_posts()) { $featured_posts->the_post(); ?> <div class="featured-content"> <div class="main-article"> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <div class="entry-content"> <header class="entry-header"> <h1 class="entry-title"><a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(sprintf(__('Permalink to %s', 'expound'), the_title_attribute('echo=0'))); ?> " rel="bookmark"><?php the_title(); ?> </a></h1>