Advertisement
Beee

attributes-public.php

Feb 12th, 2014
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. <?php // template for displaying attribute fields
  2. /*
  3.  * This file is called by templates/forms/event-editor.php to display attribute fields on your event form on your website.
  4. * You can override this file by copying it to /wp-content/themes/yourtheme/plugins/events-manager/forms/event/ and editing it there.
  5. */
  6. global $EM_Event;
  7. /* @var $EM_Event EM_Event */
  8. $attributes = em_get_attributes();
  9. $has_depreciated = false;
  10.  
  11.     if( count( $attributes['names'] ) > 0 ) :
  12.         foreach( $attributes['names'] as $name) :
  13.             // this is to hide the countdown and shortname fields
  14.             if ( $name != "Countdown" && $name != "shortname" ) { ?>
  15.             <div class="event-attributes">
  16.                 <label for="em_attributes_<?php echo $name ?> em_attributes[<?php echo $name ?>]"><?php echo $name ?></label>
  17.                 <?php if( count($attributes['values'][$name]) > 1 ): ?>
  18.                 <select name="em_attributes[<?php echo $name ?>]">
  19.                     <?php foreach($attributes['values'][$name] as $attribute_val): ?>
  20.                         <?php if( is_array($EM_Event->event_attributes) && array_key_exists($name, $EM_Event->event_attributes) && $EM_Event->event_attributes[$name]==$attribute_val ): ?>
  21.                             <option selected="selected"><?php echo $attribute_val; ?></option>
  22.                         <?php else: ?>
  23.                             <option><?php echo $attribute_val; ?></option>
  24.                         <?php endif; ?>
  25.                     <?php endforeach; ?>
  26.                 </select>
  27.                 <?php else: ?>
  28.                 <?php $default_value = (!empty($attributes['values'][$name][0])) ? $attributes['values'][$name][0]:''; ?>
  29.                 <input type="text" name="em_attributes_<?php echo $name ?> em_attributes[<?php echo $name ?>]" value="<?php echo array_key_exists($name, $EM_Event->event_attributes) ? esc_attr($EM_Event->event_attributes[$name], ENT_QUOTES):''; ?>" value="<?php echo $default_value; ?>" />
  30.                 <?php endif; ?>
  31.             </div>
  32. <?php }
  33.     endforeach;
  34.     endif;
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement