What I would suggest is to create a custom WP_Query
. What you would do is something like this (modified from ACF documentation):
<?php
$posts = get_posts( array(
'meta_query' => array(
array(
'key' => 'in_row_view',
'value' => '1',
)
)
) );
if( $posts ) {
foreach( $posts as $post ) {
// Do something.
}
}
So, in your code, you will not use the base while(have_posts())
loop but a loop iterating the post (the foreach
in my example).