Guest User

Untitled

a guest
Mar 14th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <?php
  2.  
  3. // Don't load directly
  4. if ( !defined( 'ABSPATH' ) ) {
  5. die('-1');
  6. }
  7.  
  8. /**
  9. * The Event Meta Form for editing custom fields
  10. * You can customize this view by putting a replacement file of the same name (delete.php) in the events/community/ directory of your theme.
  11. *
  12. * @package TribeCommunityEvents
  13. * @since 1.0
  14. * @author Modern Tribe Inc.
  15. */
  16.  
  17.  
  18. if ( empty( $customFields ) || !is_array( $customFields ) ) {
  19. return;
  20. }?>
  21. <table id='event-meta' class='eventtable'>
  22. <tbody>
  23. <tr><td colspan='2' class='snp_sectionheader'><span class="form_section"><?php _e( 'Additional information', 'tribe-events-community' ); ?></span><br />
  24.  
  25. <span style="font-size:11px; color:#00475E; font-style:italic">(*Required format: http://www.homepage.com)</span></td></tr>
  26. <?php
  27. foreach ( $customFields as $customField ) : ?>
  28. <?php
  29. if ( isset($_POST[ $customField['name'] ]) ) {
  30. $val = $_POST[ $customField['name'] ];
  31. } else {
  32. $val = get_post_meta( get_the_id(), $customField['name'], true );
  33. }
  34. ?>
  35. <tr>
  36. <td><label> <?php echo esc_html( stripslashes( $customField['label'] ) ) ?></label></td>
  37. <td>
  38. <?php $options = explode( "\n", $customField['values'] ) ?>
  39. <?php if($customField['type'] == 'text'): ?>
  40. <input type='text' name='<?php echo esc_attr( $customField['name'] ) ?>' size='37' value='<?php echo esc_attr( $val ) ?>'/>
  41. <?php elseif ( $customField['type'] == 'radio') : ?>
  42. <?php foreach ( $options as $option ) : ?>
  43. <div><label><input type='radio' name='<?php echo esc_attr( stripslashes( $customField['name'] ) ) ?>' value='<?php echo esc_attr( $option ) ?>' <?php checked( trim( $val ), trim( $option ) ) ?>/> <?php echo esc_html( stripslashes( $option ) ) ?></label></div>
  44. <?php endforeach ?>
  45. <?php elseif ($customField['type'] == 'checkbox') : ?>
  46. <?php foreach ( $options as $option ) : ?>
  47. <?php $values = explode( '|', $val ); ?>
  48. <div><label><input type='checkbox' value='<?php echo esc_attr( trim( $option ) ) ?>' <?php checked( in_array( trim( $option ), $values ) ) ?> name='<?php echo esc_attr( stripslashes( $customField['name'] ) ) ?>[]'/> <?php echo esc_html( stripslashes( $option ) ) ?></label></div>
  49. <?php endforeach ?>
  50. <?php elseif($customField['type'] == 'dropdown'): ?>
  51. <select name='<?php echo $customField['name']?>'>
  52. <?php $options = explode( "\n", $customField['values'] ) ?>
  53. <?php foreach ($options as $option): ?>
  54. <option value='<?php echo esc_attr( $option ) ?>' <?php selected( trim( $val ), trim( $option ) ) ?>><?php echo esc_html( stripslashes( $option ) ) ?></option>
  55. <?php endforeach ?>
  56. </select>
  57. <?php elseif ( $customField['type'] == 'textarea') : ?>
  58. <textarea name='<?php echo esc_attr( $customField['name'] ) ?>'><?php echo esc_textarea( stripslashes( $val ) ) ?></textarea>
  59. <?php endif; ?>
  60.  
  61. </td>
  62. </tr>
  63. <?php endforeach; ?>
  64. </tbody>
  65. </table>
Advertisement
Add Comment
Please, Sign In to add comment