Home Forums General Issues wordpress query compare or if?


wordpress query compare or if?

  • Hello, I have a problem to compare two dates, when they are identical (one is defined in one form and the other in a custom post type, reservation).

    But nothing works.

    Here my code

    <form class="DateReservationTerrains" action="<?php echo get_permalink(); ?>" method="post">
            <label>Date: <input type="text" id="DatePicker" name="date" autocomplete="off"></label>
            <label>Heure: <input id="TimeForm" type="text" class="time ui-timepicker-input" autocomplete="off" name="time"></label>
            <input type="submit" value="Je check les disponibilités" name="submit">
        <div class="resultatPost">
            $ChoixDate =  $_POST['date'];
            $ChoixTime =  $_POST['time'];
              echo '<p>Vous avez choisi le '. $ChoixDate . ' à ' .$ChoixTime.'</p><hr>';
        $args = array(
          'post_type' => 'reservation',
          'post_status' => 'publish',
          'posts_per_page' => -1,
       $loop = new WP_Query( $args );
        <ul style='margin-top:25px;'>
          if( get_field( 'date_de_reservations' ) ==  $ChoixDate): ?>
            <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
              <li><?php the_title(); ?>, le <?php echo get_field('date_de_reservations'); ?> à <?php echo get_field('heure_de_reservation'); ?> sur le <?php echo the_field('numero_du_terrains'); ?> 
            <?php endwhile;?>
          <?php endif; ?>

    Help plz?


Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.