Changeset 630
- Timestamp:
- 05/20/2014 11:58:54 PM (12 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors
- Files:
-
- 1 added
- 1 edited
-
classes/mes-sponsor.php (modified) (2 diffs)
-
views/template-region-dropdown.php (added)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/classes/mes-sponsor.php
r625 r630 25 25 add_action( 'admin_init', array( $this, 'add_meta_boxes' ) ); 26 26 add_action( 'save_post', array( $this, 'save_post' ), 10, 2 ); 27 add_action( 'wcpt_metabox_value', array( $this, 'wcpt_region_dropdown_render' ), 10, 3 ); 28 add_action( 'wcpt_metabox_save', array( $this, 'wcpt_region_dropdown_save' ), 10, 3 ); 27 29 add_filter( 'the_content', array( $this, 'add_header_footer_text' ) ); 28 30 } … … 193 195 194 196 /** 197 * Render the dropdown element with regions for the WordCamp Post Type plugin 198 * 199 * @param string $key 200 * @param string $value 201 * @param string $field_name 202 */ 203 public function wcpt_region_dropdown_render( $key, $value, $field_name ) { 204 if ( 'Multi-Event Sponsor Region' != $key ) { 205 return; 206 } 207 208 global $post; 209 210 $regions = get_terms( self::REGIONS_SLUG, array( 'hide_empty' => false ) ); 211 $selected_region = get_post_meta( $post->ID, $key, true ); 212 213 require( dirname( __DIR__ ) . '/views/template-region-dropdown.php' ); 214 } 215 216 /** 217 * Save the dropdown element with regions for the WordCamp Post Type plugin 218 * 219 * @param string $key 220 * @param string $value 221 * @param int $post_id 222 */ 223 public function wcpt_region_dropdown_save( $key, $value, $post_id ) { 224 if ( 'Multi-Event Sponsor Region' != $key ) { 225 return; 226 } 227 228 $post_key = wcpt_key_to_str( $key, 'wcpt_' ); 229 update_post_meta( $post_id, $key, absint( $_POST[ $post_key ] ) ); 230 } 231 232 /** 195 233 * Add the header and footer copy to the sponsorship level content 196 234 *
Note: See TracChangeset
for help on using the changeset viewer.