Answer the question
In order to leave comments, you need to log in
How to display objects through WP_Query?
Good afternoon. Similar questions were discussed many times, looked at examples but still does not want to work.
I'm trying to display objects, so to speak, from the custom section by the status field with the value Sold, it displays all objects, but only those that are Sold should.
Here is the code that shows the form with the Sold value when adding an object
array(
'name' => __('Тип сделки','aletheme'),
'desc' => __('Выберите нужный тип','aletheme'),
'id' => $prefix . 'propertycontract',
'std' => '',
'type' => 'select',
'options' => array(
array( 'name' => __('Продажа','aletheme'), 'value' => 'Sold', ),
array( 'name' => __('Аренда','aletheme'), 'value' => 'For rent', ),
),
),
<?php
$args = array(
'post_type' => 'properties',
array(
'meta_key' => 'propertycontract',
'meta_value' => 'Sold'
),
);
$ale_property_query = new WP_Query( $args );
if ($ale_property_query->have_posts()) {
while ($ale_property_query->have_posts()) { $ale_property_query->the_post();
ale_part('property-item');
}
} else {
echo '<article class="not-found"><div class="text-wrapper story"><h3>'.__('Не найдено','aletheme').'</h3></div></article>';
}
wp_reset_query();
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question