Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('add_meta_boxes', 'jpg_affiliated');
- function jpg_affiliated()
- {
- add_meta_box('jpg_affiliated_staff', 'Who Was Involved?', 'jpg_affiliated_staff_callback', 'post', 'normal', 'default');
- }
- function jpg_affiliated_staff_callback($post)
- {
- global $post;
- $custom = get_post_custom($post->ID);
- wp_nonce_field('jpg_affiliated_nonce', 'jpg_affiliated_nonce_field');
- ?>
- <p><strong>Select any staff that were involved in this event and what their role was.</strong></p>
- <div style="overflow:hidden;padding:0 0 10px 0">
- <table>
- <tr>
- <td width="10%"><input type="checkbox" id="jpg_team_member" name="jpg_team_member" value="Test"<?php if(get_post_meta($post->ID,'jpg_team_member', true ) == "Test" ){echo ' checked="checked"';} ?>></td>
- <td width="40%"><label for="jpg_team_member">Test</label></td>
- <td width="50%">
- <select name="" id="">
- <option value="">Select role...</option>
- <option value="Primary Shooter">Primary Shooter</option>
- <option value="Second Shooter">Second Shooter</option>
- <option value="Third Shooter">Third Shooter</option>
- <option value="Lighting Assitant">Lighting Assistant</option>
- <option value="Photo Booth Coordinator">Photo Booth Coordinator</option>
- <option value="Marketing Coordinator">Marketing Coordinator</option>
- <option value="Studio Manager">Studio Manager</option>
- <option value="JPG Team Member">JPG Team Member</option>
- <option value="Photogrpaher">Photographer</option>
- </select>
- </td>
- </tr>
- </table>
- </div>
- <?php
- }
- add_action('save_post', 'jpg_save_staff');
- function jpg_save_staff($post_id)
- {
- // Bail if we're doing an auto save
- if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
- // if our nonce isn't there, or we can't verify it, bail
- if(!isset($_POST['jpg_affiliated_nonce_field']) || !wp_verify_nonce($_POST['jpg_affiliated_nonce_field'], 'jpg_affiliated_nonce' )) return;
- // if our current user can't edit this post, bail
- if(!current_user_can('edit_post')) return;
- // Probably a good idea to make sure your data is set
- if(isset($_POST['jpg_team_member'])){update_post_meta($post_ID, 'jpg_team_member', esc_attr($_POST['jpg_team_member']));} else {update_post_meta($post_ID, 'jpg_team_member','');}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement