I am developing a travel website for an agency. I'm trying to to make the user able to select an option like "Select your departure" and filter the loop with all the departures available for the chosen option. Ie: if I want to check all the departures from Chicago, so the loop will only show the Chicago departures!
<?php $args = array( 'post_type' => 'travel_packs', 'order' => 'ASC', ); $the_query = new WP_Query( $args ); if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> //The loop: <a href="<?php the_permalink(); ?>"> Destination: <?php the_field('destination'); ?> Departing from:<?php the_field('departures'); ?> Price:<?php the_field('price'); ?> </a> <?php endwhile; endif; ?>
I thought about the
$_GET method, but I'm not sure how to assimilate it with the