- <script>
- var shiftaddb =jQuery.noConflict();
- shiftaddb(document).ready(function() {
- var count = <?php echo $c; ?>;
- shiftaddb(".add").click(function() {
- count = count + 1;
- output = '<p><?php _e('Day', 'radio-station'); ?>: ';
- output += '<select name="show_sched[' + count + '][day]">';
- output += '<option value=""></option>';
- output += '<option value="Monday"><?php _e('Monday', 'radio-station'); ?></option>';
- output += '<option value="Tuesday"><?php _e('Tuesday', 'radio-station'); ?></option>';
- output += '<option value="Wednesday"><?php _e('Wednesday', 'radio-station'); ?></option>';
- output += '<option value="Thursday"><?php _e('Thursday', 'radio-station'); ?></option>';
- output += '<option value="Friday"><?php _e('Friday', 'radio-station'); ?></option>';
- output += '<option value="Saturday"><?php _e('Saturday', 'radio-station'); ?></option>';
- output += '<option value="Sunday"><?php _e('Sunday', 'radio-station'); ?></option>';
- output += '</select>';
- output += ' - <?php _e('Start Time', 'radio-station'); ?>: ';
- output += '<select name="show_sched[' + count + '][start_hour]">';
- output += '<option value=""></option>';
- <?php for($i=1; $i<=12; $i++): ?>
- output += '<option value="<?php echo $i; ?>"><?php echo $i; ?></option>';
- <?php endfor; ?>
- output += '</select> ';
- output += '<select name="show_sched[' + count + '][start_min]">';
- output += '<option value=""></option>';
- <?php for($i=0; $i<60; $i++): ?>
- <?php
- $min = $i;
- if($i < 10) {
- $min = '0'.$i;
- }
- ?>
- output += '<option value="<?php echo $min; ?>"><?php echo $min; ?></option>';
- <?php endfor; ?>
- output += '</select> ';
- output += '<select name="show_sched[' + count + '][start_meridian]">';
- output += '<option value=""></option>';
- output += '<option value="am">am</option>';
- output += '<option value="pm">pm</option>';
- output += '</select> ';
- output += ' - <?php _e('End Time', 'radio-station'); ?>: ';
- output += '<select name="show_sched[' + count + '][end_hour]">';
- output += '<option value=""></option>';
- <?php for($i=1; $i<=12; $i++): ?>
- output += '<option value="<?php echo $i; ?>"><?php echo $i; ?></option>';
- <?php endfor; ?>
- output += '</select> ';
- output += '<select name="show_sched[' + count + '][end_min]">';
- output += '<option value=""></option>';
- <?php for($i=0; $i<60; $i++): ?>
- <?php
- $min = $i;
- if($i < 10) {
- $min = '0'.$i;
- }
- ?>
- output += '<option value="<?php echo $min; ?>"><?php echo $min; ?></option>';
- <?php endfor; ?>
- output += '</select> ';
- output += '<select name="show_sched[' + count + '][end_meridian]">';
- output += '<option value=""></option>';
- output += '<option value="am">am</option>';
- output += '<option value="pm">pm</option>';
- output += '</select> ';
- output += '<input type="checkbox" name="show_sched[' + count + '][encore]" /> <?php _e('Encore', 'radio-station'); ?> ';
- output += '<span class="remove button-secondary" style="cursor: pointer;"><?php _e('Remove', 'radio-station'); ?></span>';
- output += ' - <?php _e('Week', 'radio-station'); ?>: ';
- output += '<select name="show_sched[' + count + '][show_frequency]" multiple="multiple" size="4">';
- output += '<option value=""></option>';
- <?php for($i=1; $i<=5; $i++): ?>
- output += '<option value="<?php echo $i; ?>"><?php echo $i; ?></option>';
- <?php endfor; ?>
- output += '</select></p> ';
- shiftaddb('#here').append( output );
- return false;
- });
- shiftaddb(".remove").live('click', function() {
- shiftaddb(this).parent().remove();
- });
- });
- </script>
- </div>
- <?php
- }
- //save the custom fields when a show is saved
- function myplaylist_save_showpostdata( $post_id ) {
- // verify if this is an auto save routine.
- // If it is our form has not been submitted, so we dont want to do anything
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
- return;
- // verify this came from the our screen and with proper authorization,
- // because save_post can be triggered at other times
- if (isset($_POST['dynamicMetaUser_noncename'])){
- if ( !wp_verify_nonce( $_POST['dynamicMetaUser_noncename'], plugin_basename( __FILE__ ) ) )
- return;
- }else{return;
- }
- if (isset($_POST['dynamicMetaSched_noncename'])){
- if ( !wp_verify_nonce( $_POST['dynamicMetaSched_noncename'], plugin_basename( __FILE__ ) ) )
- return;
- }else{return;
- }
- // OK, we're authenticated: we need to find and save the data
- $djs = $_POST['show_user_list'];
- $sched = $_POST['show_sched'];
- $file = $_POST['show_file'];
- $email = $_POST['show_email'];
- $active = $_POST['show_active'];
- $link = $_POST['show_link'];
- update_post_meta($post_id,'show_user_list',$djs);
- update_post_meta($post_id,'show_sched',$sched);
- update_post_meta($post_id,'show_file',$file);
- update_post_meta($post_id,'show_email',$email);
- update_post_meta($post_id,'show_active',$active);
- update_post_meta($post_id,'show_link',$link);
- }
- add_action( 'save_post', 'myplaylist_save_showpostdata' );
Stikked
