G2A Many GEOs
SHARE
TWEET

custom atrributes-public.php template

eventsmanager Sep 15th, 2015 207 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  /*
  3.    - hide selected attribute from showing in public event submission form
  4.    - using template forms/event/atrributes-public.php
  5.   */
  6. ?>
  7. <?php
  8. /*
  9.  * This file is called by templates/forms/event-editor.php to display attribute fields on your event form on your website.
  10. * You can override this file by copying it to /wp-content/themes/yourtheme/plugins/events-manager/forms/event/ and editing it there.
  11. */
  12. global $EM_Event;
  13. /* @var $EM_Event EM_Event */
  14. $attributes = em_get_attributes();
  15. $has_depreciated = false;
  16. ?>
  17. <?php if( count( $attributes['names'] ) > 0 ) : ?>
  18.         <?php foreach( $attributes['names'] as $name) : ?>
  19.        
  20.         $hide = array('att1','att2); //attribute name you've wanted to hide
  21.        
  22.         if ( !in_array($name,$hide) ):
  23.        
  24.                 <div class="event-attributes">
  25.                         <label for="em_attributes[<?php echo $name ?>]"><?php echo $name ?></label>
  26.                         <?php if( count($attributes['values'][$name]) > 1 ): ?>
  27.                         <select name="em_attributes[<?php echo $name ?>]">
  28.                                 <?php foreach($attributes['values'][$name] as $attribute_val): ?>
  29.                                         <?php if( is_array($EM_Event->event_attributes) && array_key_exists($name, $EM_Event->event_attributes) && $EM_Event->event_attributes[$name]==$attribute_val ): ?>
  30.                                                 <option selected="selected"><?php echo $attribute_val; ?></option>
  31.                                         <?php else: ?>
  32.                                                 <option><?php echo $attribute_val; ?></option>
  33.                                         <?php endif; ?>
  34.                                 <?php endforeach; ?>
  35.                         </select>
  36.                         <?php else: ?>
  37.                         <?php $default_value = (!empty($attributes['values'][$name][0])) ? $attributes['values'][$name][0]:''; ?>
  38.                         <input type="text" 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; ?>" />
  39.                         <?php endif; ?>
  40.                 </div> 
  41.        
  42.         endif;
  43.        
  44.        
  45.         <?php endforeach; ?>
  46. <?php endif; ?>
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top