Created
February 28, 2012 23:27
-
-
Save menslow/1936065 to your computer and use it in GitHub Desktop.
WordPress: Template Part: State Dropdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $input_state_province, $input_required, $selected_state; | |
?> | |
<label class="unitx1"><?php _e('State'); ?> <?php if($input_required) : echo '*'; endif; ?> | |
<select id="<?php echo esc_attr($input_state_province); ?>" name="<?php echo esc_attr($input_state_province); ?>" class="<?php if($input_state_province) : echo 'required'; endif; ?>"> | |
<option value=""<?php if($selected_state==='') : echo ' selected="selected"'; endif; ?>><?php _e('Please Select'); ?></option> | |
<option value="AL"<?php if($selected_state==='AL') : echo ' selected="selected"'; endif; ?>><?php _e('AL'); ?></option> | |
<option value="AK"<?php if($selected_state==='AK') : echo ' selected="selected"'; endif; ?>><?php _e('AK'); ?></option> | |
<option value="AZ"<?php if($selected_state==='AZ') : echo ' selected="selected"'; endif; ?>><?php _e('AZ'); ?></option> | |
<option value="AR"<?php if($selected_state==='AR') : echo ' selected="selected"'; endif; ?>><?php _e('AR'); ?></option> | |
<option value="CA"<?php if($selected_state==='CA') : echo ' selected="selected"'; endif; ?>><?php _e('CA'); ?></option> | |
<option value="CO"<?php if($selected_state==='CO') : echo ' selected="selected"'; endif; ?>><?php _e('CO'); ?></option> | |
<option value="CT"<?php if($selected_state==='CT') : echo ' selected="selected"'; endif; ?>><?php _e('CT'); ?></option> | |
<option value="DE"<?php if($selected_state==='DE') : echo ' selected="selected"'; endif; ?>><?php _e('DE'); ?></option> | |
<option value="DC"<?php if($selected_state==='DC') : echo ' selected="selected"'; endif; ?>><?php _e('DC'); ?></option> | |
<option value="FL"<?php if($selected_state==='FL') : echo ' selected="selected"'; endif; ?>><?php _e('FL'); ?></option> | |
<option value="GA"<?php if($selected_state==='GA') : echo ' selected="selected"'; endif; ?>><?php _e('GA'); ?></option> | |
<option value="HI"<?php if($selected_state==='HI') : echo ' selected="selected"'; endif; ?>><?php _e('HI'); ?></option> | |
<option value="ID"<?php if($selected_state==='ID') : echo ' selected="selected"'; endif; ?>><?php _e('ID'); ?></option> | |
<option value="IL"<?php if($selected_state==='IL') : echo ' selected="selected"'; endif; ?>><?php _e('IL'); ?></option> | |
<option value="IN"<?php if($selected_state==='IN') : echo ' selected="selected"'; endif; ?>><?php _e('IN'); ?></option> | |
<option value="IA"<?php if($selected_state==='IA') : echo ' selected="selected"'; endif; ?>><?php _e('IA'); ?></option> | |
<option value="KS"<?php if($selected_state==='KS') : echo ' selected="selected"'; endif; ?>><?php _e('KS'); ?></option> | |
<option value="KY"<?php if($selected_state==='KY') : echo ' selected="selected"'; endif; ?>><?php _e('KY'); ?></option> | |
<option value="LA"<?php if($selected_state==='LA') : echo ' selected="selected"'; endif; ?>><?php _e('LA'); ?></option> | |
<option value="ME"<?php if($selected_state==='ME') : echo ' selected="selected"'; endif; ?>><?php _e('ME'); ?></option> | |
<option value="MD"<?php if($selected_state==='MD') : echo ' selected="selected"'; endif; ?>><?php _e('MD'); ?></option> | |
<option value="MA"<?php if($selected_state==='MA') : echo ' selected="selected"'; endif; ?>><?php _e('MA'); ?></option> | |
<option value="MI"<?php if($selected_state==='MI') : echo ' selected="selected"'; endif; ?>><?php _e('MI'); ?></option> | |
<option value="MN"<?php if($selected_state==='MN') : echo ' selected="selected"'; endif; ?>><?php _e('MN'); ?></option> | |
<option value="MS"<?php if($selected_state==='MS') : echo ' selected="selected"'; endif; ?>><?php _e('MS'); ?></option> | |
<option value="MO"<?php if($selected_state==='MO') : echo ' selected="selected"'; endif; ?>><?php _e('MO'); ?></option> | |
<option value="MT"<?php if($selected_state==='MT') : echo ' selected="selected"'; endif; ?>><?php _e('MT'); ?></option> | |
<option value="NE"<?php if($selected_state==='NE') : echo ' selected="selected"'; endif; ?>><?php _e('NE'); ?></option> | |
<option value="NV"<?php if($selected_state==='NV') : echo ' selected="selected"'; endif; ?>><?php _e('NV'); ?></option> | |
<option value="NH"<?php if($selected_state==='NH') : echo ' selected="selected"'; endif; ?>><?php _e('NH'); ?></option> | |
<option value="NJ"<?php if($selected_state==='NJ') : echo ' selected="selected"'; endif; ?>><?php _e('NJ'); ?></option> | |
<option value="NM"<?php if($selected_state==='NM') : echo ' selected="selected"'; endif; ?>><?php _e('NM'); ?></option> | |
<option value="NY"<?php if($selected_state==='NY') : echo ' selected="selected"'; endif; ?>><?php _e('NY'); ?></option> | |
<option value="NC"<?php if($selected_state==='NC') : echo ' selected="selected"'; endif; ?>><?php _e('NC'); ?></option> | |
<option value="ND"<?php if($selected_state==='ND') : echo ' selected="selected"'; endif; ?>><?php _e('ND'); ?></option> | |
<option value="OH"<?php if($selected_state==='OH') : echo ' selected="selected"'; endif; ?>><?php _e('OH'); ?></option> | |
<option value="OK"<?php if($selected_state==='OK') : echo ' selected="selected"'; endif; ?>><?php _e('OK'); ?></option> | |
<option value="OR"<?php if($selected_state==='OR') : echo ' selected="selected"'; endif; ?>><?php _e('OR'); ?></option> | |
<option value="PA"<?php if($selected_state==='PA') : echo ' selected="selected"'; endif; ?>><?php _e('PA'); ?></option> | |
<option value="RI"<?php if($selected_state==='RI') : echo ' selected="selected"'; endif; ?>><?php _e('RI'); ?></option> | |
<option value="SC"<?php if($selected_state==='SC') : echo ' selected="selected"'; endif; ?>><?php _e('SC'); ?></option> | |
<option value="SD"<?php if($selected_state==='SD') : echo ' selected="selected"'; endif; ?>><?php _e('SD'); ?></option> | |
<option value="TN"<?php if($selected_state==='TN') : echo ' selected="selected"'; endif; ?>><?php _e('TN'); ?></option> | |
<option value="TX"<?php if($selected_state==='TX') : echo ' selected="selected"'; endif; ?>><?php _e('TX'); ?></option> | |
<option value="UT"<?php if($selected_state==='UT') : echo ' selected="selected"'; endif; ?>><?php _e('UT'); ?></option> | |
<option value="VT"<?php if($selected_state==='VT') : echo ' selected="selected"'; endif; ?>><?php _e('VT'); ?></option> | |
<option value="VA"<?php if($selected_state==='VA') : echo ' selected="selected"'; endif; ?>><?php _e('VA'); ?></option> | |
<option value="WA"<?php if($selected_state==='WA') : echo ' selected="selected"'; endif; ?>><?php _e('WA'); ?></option> | |
<option value="WV"<?php if($selected_state==='WV') : echo ' selected="selected"'; endif; ?>><?php _e('WV'); ?></option> | |
<option value="WI"<?php if($selected_state==='WI') : echo ' selected="selected"'; endif; ?>><?php _e('WI'); ?></option> | |
<option value="WY"<?php if($selected_state==='WY') : echo ' selected="selected"'; endif; ?>><?php _e('WY'); ?></option> | |
</select> | |
</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Corrected some auto-replace errors which added an extra ">" after each state value.