Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thebigtine
Created February 17, 2017 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebigtine/499e58cb76c5c18127722f86ab893006 to your computer and use it in GitHub Desktop.
Save thebigtine/499e58cb76c5c18127722f86ab893006 to your computer and use it in GitHub Desktop.
<?php $temp_query = $wp_query;
$args = array(
'post_type' => 'region'
);
query_posts($args);
if (have_posts()) { ?>
<form>
<select id="event-region-select" autocomplete="off" onchange='doSubmit();'>
<option disabled selected>Select a region</option>
<?php while (have_posts()) : the_post();
$id = get_the_ID();
?>
<option value="<?php the_field('region_slug'); ?>"><?php the_title(); ?></option>
<?php
endwhile;
wp_reset_query();
?>
</select>
</form>
<?php } else { ?>
<form>
<select id="event-region-select" autocomplete="off" onchange='doSubmit();'>
<option disabled selected>Select a region</option>
<option value="northland">Northland</option>
<option value="north-shore-auckland">North Shore - Auckland</option>
<option value="auckland">Auckland</option>
<option value="waikato">Waikato</option>
<option value="bay-of-plenty">Bay of Plenty</option>
<option value="hawkes-bay">Hawkes Bay</option>
<option value="wellington">Wellington</option>
<option value="christchurch">Christchurch</option>
<option value="queenstown">Queenstown</option>
<option value="sydney">Sydney</option>
</select>
</form>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment