Keep featured content post in homepage with original order
-
Hello,
I’m searching how to keep the featured post in a blog homepage (https://naziman.com/) without exclude it from query post and 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 overide parent theme’s inc folder.
Then, i have found another solution and its work.
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 than 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 – but in homepage still have problem.
Can anyone tell me? Thanks.
- The topic ‘Keep featured content post in homepage with original order’ is closed to new replies.