How to create & add Meta Query in Elementor Loop Grid / Post Grid
HTML-код
- Опубликовано: 22 июн 2024
- How to filter posts in Elementor loop grid using meta query
----------------------------------------------------------------------------------
I have included the PHP code in the first comment
-----------------------------------------------------------------------------------
Facebook: / panthoprodhanofficial
LinkedIn: / pantho-prodhan
Instagram: / instapantho
Website: panthoprodhan.com/
-----------------------------------------------------------------------------------
Thanks for watching! If you enjoyed the video, please give it a thumbs up, drop a comment, and remember to subscribe!
-----------------------------------------------------------------------------------
For business and other inquiries:
pantho@panthoprodhan.com
#elementor
#elementordynamiccontent
#elementortutorial
#wordpress
#webdesign - Наука
Custom Code for Meta Query:
function my_query_by_post_meta( $query ) {
// Get current meta Query
$meta_query = $query->get( 'meta_query' );
// If there is no meta query when this filter runs, it should be initialized as an empty array.
if ( ! $meta_query ) {
$meta_query = [];
}
// Append our meta query
$meta_query[] = [
'key' => 'project_type',
'value' => [ 'design', 'development' ],
'compare' => 'in',
];
$query->set( 'meta_query', $meta_query );
}
add_action( 'elementor/query/{$query_id}', 'my_query_by_post_meta' );
Good job am in your last video on crocoblock can you create an admin dashboard where he can remove, add, or delete post from front end
I will
@@PanthoProdhan i am follow ur video and doing what u are doing