Create featured post in elementor builder using ACF

Create acf field first for handle which post make to featured, you can follow this screenshot below

acf field featured post
acf field featured post

After acf field has been created, insert this code on snippet or functions.php

add_action( 'elementor/query/featured_query', function( $query ) {
	$query->set( 'post_type', 'post' );
	$query->set( 'order', 'ASC' );
	$meta_query[] = [
		'key' => 'post_featured',
		'value' => '1',
		'compare' => '=',
	];
	$query->set( 'meta_query', $meta_query );
} );

Open elementor builder and add post widget follow this screenshot
elementor query ID





Tags