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?