I'm searching how to keep the featured post in my blog homepage without excluding it from query post. My blog uses the Twenty Fourteen theme. I found this solution.

Open the featured-content.php from your theme's inc folder, and look for the following code (line 269 in our case).

$query->set( 'post__not_in', $featured );

Simply comment out this line, by adding two slashes in front of it, to get this:

// $query->set( 'post__not_in', $featured );

But the file doesn't have that line and the child theme cannot override the parent theme's inc folder.

I have found another solution and it works, but, the problem is this code show the featured content post not in their original order. When old content post - I'm using sticky post to make featured post - become featured, the featured content post will become the first order then the other post.

I have try using conditional tag like this.

function show_featured_content_on_home() {
if ( !is_home() ) {
remove_action( 'pre_get_posts', array( 'Featured_Content', 'pre_get_posts' ) );
add_action( 'init', 'show_featured_content_on_home', 31 );

The second page and so on okay - show the featured posts in order - but the homepage still have problem.

Any suggestions?

  • I think i have the answer. To make it works, you must use the 'featured' tag than using sticky post to make featured content. So the solution is correct and i have wrong understanding and give wrong question. The conditional tag, you can remove it because the code functional without conditional tags. Commented Jun 13, 2014 at 6:23
  • 1
    I know this is pretty late but would you mind adding the above comment as an answer? This question has quite some upvotes and having a proper answer makes it more obvious. Thanks in advance!
    – kraftner
    Commented Jul 5, 2017 at 7:34

1 Answer 1


I think you can use the WPQuery

    $the_query = new WP_Query( array( 'post__in' => get_option( 'sticky_posts' )) ); ?>

    <?php if ( $the_query->have_posts() ) : ?>

        <!-- pagination here -->

        <!-- the loop -->
        <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>   
<h2><?php the_title(); ?></h2>
        <?php endwhile; ?>
        <!-- end of the loop -->

        <!-- pagination here -->

        <?php wp_reset_postdata(); ?>

    <?php endif; ?>

and for ordering your post you can use order and orderby see reference https://codex.wordpress.org/Class_Reference/WP_Query

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.