Answer the question
In order to leave comments, you need to log in
Why doesn't meta_query work with ACF fields?
Hello. The selection of posts by ACF fields does not work, I can not understand what the problem is. Posts like tours have custom ACF fields,
I want to get posts by custom field price (ACF)
$args7 = array(
'post_type' => 'tours',
'meta_query' => array(
array(
'key' => 'tour_price',
'value' => array( 1000, 7000 ),
'compare' => 'BETWEEN'
)
)
);
$query = new WP_Query($arg7);
if ($query->have_posts()): while ($query->have_posts()): $query->the_post(); ?>
Answer the question
In order to leave comments, you need to log in
Hello. You store the query parameters in the $args7 variable, and pass another (unknown, empty) $arg7 variable to the WP_Query() class. Therefore, it doesn't work.
$wp_query = array(
'post_type' => 'page',
'posts_per_page' => 4,
'meta_query' => [
'relation' => 'AND',
]
);
if(isset($_GET["priceMin"]) or isset($_GET["priceMax"])){
$priceMin = $_GET["priceMin"];
$priceMax = $_GET["priceMax"];
if($priceMin or $priceMax){
$wp_query['meta_query'][] = array(
'priceMinMax_query' => array(
'key' => 'price',
'value' => array($_GET["priceMin"], $_GET["priceMax"]), // значение в промежутке от-до
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
);
}
}
As far as I understand, you need to read this and this
Almost perfect solution: cssdeck.com/labs/8qsqyyqr
And "almost" because when the menu wraps over two or more lines, the last item of the penultimate line is indented from the right edge.
So undo this very last indent, there are special pseudo-classes:
selector:first-child{стили} /*Первый элемент родителся*/
selector:last-child{стили} /*Первый элемент родителся*/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question