I am experiencing abnormal behavior of my code, with this query here:
$v_args = array(
'post_type' => get_option('customer_postquery'),
'posts_per_page' => -1,
'order' => 'ASC',
'meta_query' => array(
array (
'key' => 'metakey_AMC_data',
),
),
'tax_query' => array(
array(
'taxonomy' => 'categoria',
'field' => 'slug',
'terms' => $queried_object,
)
)
);
$vehicleSearchQuery = new WP_Query( $v_args );
I take out all the posts of all my custom post types that belong to a given taxonomy.
But if I only have a custom post type it works perfectly if I adjust more than one bust all the dates:
if( $vehicleSearchQuery->have_posts() ) :
while( $vehicleSearchQuery->have_posts() ) : $vehicleSearchQuery->the_post();
?>
<?php
$var = get_post_meta(get_the_ID(),'metakey_AMC_data',true);
$data_dell_evento = date("Y-m-d", strtotime( $var ));
/*PRENDERE LA DATA CORRENTE IN FORMATO Y-m-d DIRETTAMENTE DA MYSQL*/
$data_di_oggi = date( 'Y-m-d', current_time( 'timestamp', 0 ) );
if ($data_dell_evento > $data_di_oggi ): ?>
<div style="padding-top: 25px;" class="col-md-4"><!-- Card -->
<?php include('content/home_page/card.php'); ?>
</div>
<?php endif; ?>
<?php
endwhile;
else :
?>
<?php
endif;
wp_reset_postdata();
?>
if I do echo of the variable: $data_dell_evento
, i have this:
2019-09-01
2019-09-02
2019-09-30
2019-10-03
2019-10-01
2019-10-01
begin error
2019-10-10
2019-10-08
2019-10-04
why do i have this sort?
Aucun commentaire:
Enregistrer un commentaire