现在,有了新的信息,我想说:
?>
<form method="post" action="where_ever_you_want_to_point_the_user_afterwards.php">
/* The loop: */
if (the_field(\'departures\') == \'user_departure_location\') {
<input type="radio" name="destination" value="<?php echo the_field(\'destination\'); ?>">
<a href="<?php the_permalink(); ?>">
Destination: <?php the_field(\'destination\'); ?>
Departing from:<?php the_field(\'departures\'); ?>
Price:<?php the_field(\'price\'); ?>
</a>
}
/* The loop end */
?></form>
然后在where\\u ever\\u you\\u want\\u指向\\u user\\u之后。php您可以通过执行以下操作或其他您喜欢的操作来检查他所做的选择。
switch ($_POST["actual_name_of_destination_in_the_form"]) {
case \'Dallas\':
/* Whatever should happen next */
break;
/* Many more cases of course... */
}
更新:我找到了一种更好的过滤方式。。。愚蠢的我:D
$args = array(
\'post_type\' => \'travel_packs\',
\'meta_key\' => \'departures\',
\'meta_value\' => \'USER_DEPARTURES_LOCATION\'
\'order\' => \'ASC\',
);
$query = new WP_Query( $args );
干杯!