Advertisement
BakerMan

Fixed country/state (Community 1.0.5) pt 1

May 7th, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.94 KB | None | 0 0
  1. <tr class="venue">
  2.     <td><?php _e('Country:','tribe-events-calendar'); ?></td>
  3.     <td>
  4.         <?php
  5.             $countries = TribeEventsViewHelpers::constructCountries( $postId );
  6.             $defaultCountry = tribe_get_option('defaultCountry');
  7.             if (isset($_VenueCountry) && $_VenueCountry) {
  8.                 $current = $_VenueCountry;
  9.             } elseif (isset($defaultCountry[1]) && tribe_get_option('defaultValueReplace')) {
  10.                 $current = $defaultCountry[1];
  11.             } else {
  12.                 $current = null;
  13.             }
  14.         ?>
  15.         <select class="chosen" tabindex="<?php $this->tabIndex(); ?>" name='venue[Country]' id="EventCountry">
  16.             <?php
  17.             foreach ($countries as $abbr => $fullname) {
  18.                 if ( $abbr == '' ) {
  19.                     echo '<option value="">' . esc_html( $fullname ) . '</option>';
  20.                 } else {
  21.                     echo '<option value="' . esc_attr($fullname) . '" ';
  22.    
  23.                     selected(($current == $fullname));
  24.    
  25.                     echo '>' . esc_html($fullname) . '</option>';
  26.                 }
  27.             }
  28.             ?>
  29.         </select>
  30.     </td>
  31. </tr>
  32. <tr class="venue">
  33.     <?php if(!isset($_VenueStateProvince) || $_VenueStateProvince == "") $_VenueStateProvince = -1; ?>
  34.     <td><?php _e('State or Province:','tribe-events-calendar'); ?></td>
  35.     <td><input tabindex="<?php $this->tabIndex(); ?>" id="StateProvinceText" name="venue[Province]" type='text' name='' size='25' value='<?php echo ( isset($_VenueStateProvince) && $_VenueStateProvince != '' && $_VenueStateProvince != -1 ) ? esc_attr($_VenueProvince) : esc_attr(''); ?>' />
  36.     <select class="chosen" tabindex="<?php $this->tabIndex(); ?>" id="StateProvinceSelect" name="venue[State]">
  37.         <option value=""><?php _e('Select a State:','tribe-events-calendar'); ?></option>
  38.         <?php
  39.             foreach (TribeEventsViewHelpers::loadStates() as $abbr => $fullname) {
  40.                 echo '<option value="'.$abbr.'"';
  41.                 if( $_VenueStateProvince != -1 ){
  42.                     selected((( $_VenueStateProvince != -1 ? $_VenueStateProvince : $_VenueState) == $abbr));
  43.                 }
  44.                 echo '>' . esc_html($fullname) . '</option>';
  45.             }
  46.         ?>
  47.     </select>
  48.  
  49.     </td>
  50. </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement