/** * Output the metabox */ public static function output($post) { global $post, $wp_locale; wp_nonce_field('wpclubmanager_save_data', 'wpclubmanager_meta_nonce'); $number = get_post_meta($post->ID, 'wpcm_number', true); $position_id = null; $positions = get_the_terms($post->ID, 'wpcm_position'); $position_ids = array(); if ($positions) { foreach ($positions as $position) { $position_ids[] = $position->term_id; } } $dob = get_post_meta($post->ID, 'wpcm_dob', true); if (empty($dob)) { $dob = '1988-01-01'; } $dob_day = substr($dob, 8, 2); $dob_month = substr($dob, 5, 2); $dob_year = substr($dob, 0, 4); $height = get_post_meta($post->ID, 'wpcm_height', true); $weight = get_post_meta($post->ID, 'wpcm_weight', true); $natl = get_post_meta($post->ID, 'wpcm_natl', true); $hometown = get_post_meta($post->ID, 'wpcm_hometown', true); $prevclubs = get_post_meta($post->ID, 'wpcm_prevclubs', true); $time_adj = current_time('timestamp'); wpclubmanager_wp_text_input(array('id' => 'wpcm_number', 'label' => __('Squad Number', 'wp-club-manager'), 'class' => 'small-text')); ?> <p> <label><?php _e('Position', 'wp-club-manager'); ?> </label> <?php $args = array('taxonomy' => 'wpcm_position', 'name' => 'tax_input[wpcm_position][]', 'selected' => $position_ids, 'values' => 'term_id', 'placeholder' => sprintf(__('Choose %s', 'wp-club-manager'), __('positions', 'wp-club-manager')), 'class' => '', 'attribute' => 'multiple', 'chosen' => true); wpcm_dropdown_taxonomies($args); ?> </p> <p> <label><?php _e('Date of Birth', 'wp-club-manager'); ?> </label> <select name="wpcm_dob_day" id="wpcm_dob_day" class="chosen_select_dob"> <?php for ($a = 1; $a < 32; $a = $a + 1) { ?> <option value="<?php echo zeroise($a, 2); ?> "<?php echo $a == $dob_day ? ' selected="selected"' : ''; ?> > <?php echo zeroise($a, 2); ?> </option> <?php } ?> </select> <select name="wpcm_dob_month" id="wpcm_dob_month" class="chosen_select_dob"> <?php for ($i = 1; $i < 13; $i = $i + 1) { ?> <option value="<?php echo zeroise($i, 2); ?> "<?php echo $i == $dob_month ? ' selected="selected"' : ''; ?> > <?php echo zeroise($i, 2); ?> -<?php echo $wp_locale->get_month_abbrev($wp_locale->get_month($i)); ?> </option> <?php } ?> </select> <input type="text" name="wpcm_dob_year" id="wpcm_dob_year" value="<?php echo $dob_year; ?> " size="4" maxlength="4" autocomplete="off" /> </p><?php wpclubmanager_wp_text_input(array('id' => 'wpcm_height', 'label' => __('Height', 'wp-club-manager'), 'class' => 'measure-text')); wpclubmanager_wp_text_input(array('id' => 'wpcm_weight', 'label' => __('Weight', 'wp-club-manager'), 'class' => 'measure-text')); wpclubmanager_wp_text_input(array('id' => 'wpcm_hometown', 'label' => __('Birthplace', 'wp-club-manager'), 'class' => 'regular-text')); wpclubmanager_wp_country_select(array('id' => 'wpcm_natl', 'label' => __('Nationality', 'wp-club-manager'))); wpclubmanager_wp_textarea_input(array('id' => 'wpcm_prevclubs', 'label' => __('Previous Clubs', 'wp-club-manager'), 'class' => 'regular-text')); }
public function request_filter_dropdowns() { global $typenow, $wp_query; if ($typenow == 'wpcm_match') { // comp dropdown $selected = isset($_REQUEST['wpcm_comp']) ? $_REQUEST['wpcm_comp'] : null; $args = array('show_option_all' => sprintf(__('Show all %s', 'wp-club-manager'), __('competitions', 'wp-club-manager')), 'taxonomy' => 'wpcm_comp', 'name' => 'wpcm_comp', 'selected' => $selected); wpcm_dropdown_taxonomies($args); echo PHP_EOL; // season dropdown $selected = isset($_REQUEST['wpcm_season']) ? $_REQUEST['wpcm_season'] : null; $args = array('show_option_all' => sprintf(__('Show all %s', 'wp-club-manager'), __('seasons', 'wp-club-manager')), 'taxonomy' => 'wpcm_season', 'name' => 'wpcm_season', 'selected' => $selected); wpcm_dropdown_taxonomies($args); echo PHP_EOL; // team dropdown $selected = isset($_REQUEST['wpcm_team']) ? $_REQUEST['wpcm_team'] : null; $args = array('show_option_all' => sprintf(__('Show all %s', 'wp-club-manager'), __('teams', 'wp-club-manager')), 'taxonomy' => 'wpcm_team', 'name' => 'wpcm_team', 'selected' => $selected); wpcm_dropdown_taxonomies($args); echo PHP_EOL; } }
/** * Output the metabox */ public static function output($post) { global $post, $wp_locale; wp_nonce_field('wpclubmanager_save_data', 'wpclubmanager_meta_nonce'); $job_id = null; $jobs = get_the_terms($post->ID, 'wpcm_jobs'); $job_ids = array(); if ($jobs) { foreach ($jobs as $job) { $job_ids[] = $job->term_id; } } $dob = get_post_meta($post->ID, 'wpcm_dob', true); if (empty($dob)) { $dob = '1988-01-01'; } $dob_day = substr($dob, 8, 2); $dob_month = substr($dob, 5, 2); $dob_year = substr($dob, 0, 4); $natl = get_post_meta($post->ID, 'wpcm_natl', true); $time_adj = current_time('timestamp'); ?> <p> <label><?php _e('Job Title', 'wp-club-manager'); ?> </label> <?php $args = array('taxonomy' => 'wpcm_jobs', 'name' => 'tax_input[wpcm_jobs][]', 'selected' => $job_ids, 'values' => 'term_id', 'placeholder' => sprintf(__('Choose %s', 'wp-club-manager'), __('jobs', 'wp-club-manager')), 'class' => '', 'attribute' => 'multiple', 'chosen' => true); wpcm_dropdown_taxonomies($args); ?> </p> <?php wpclubmanager_wp_text_input(array('id' => '_wpcm_staff_email', 'label' => __('Email Address', 'wp-club-manager'), 'class' => 'regular-text')); wpclubmanager_wp_text_input(array('id' => '_wpcm_staff_phone', 'label' => __('Contact Number', 'wp-club-manager'), 'class' => 'regular-text')); ?> <p> <label><?php _e('Date of Birth', 'wp-club-manager'); ?> </label> <select name="wpcm_dob_day" id="wpcm_dob_day" class="chosen_select_dob"> <?php for ($i = 1; $i < 32; $i = $i + 1) { ?> <option value="<?php echo zeroise($i, 2); ?> "<?php echo $i == $dob_day ? ' selected="selected"' : ''; ?> > <?php echo zeroise($i, 2); ?> </option> <?php } ?> </select> <select name="wpcm_dob_month" id="wpcm_dob_month" class="chosen_select_dob"> <?php for ($i = 1; $i < 13; $i = $i + 1) { ?> <option value="<?php echo zeroise($i, 2); ?> "<?php echo $i == $dob_month ? ' selected="selected"' : ''; ?> > <?php echo zeroise($i, 2); ?> -<?php echo $wp_locale->get_month_abbrev($wp_locale->get_month($i)); ?> </option> <?php } ?> </select> <input type="text" name="wpcm_dob_year" id="wpcm_dob_year" value="<?php echo $dob_year; ?> " size="4" maxlength="4" autocomplete="off" /> </p><?php wpclubmanager_wp_country_select(array('id' => 'wpcm_natl', 'label' => __('Nationality', 'wp-club-manager'))); }