/** * Output the metabox */ public static function output($post) { wp_nonce_field('sportspress_save_data', 'sportspress_meta_nonce'); $taxonomies = get_object_taxonomies('sp_table'); $select = get_post_meta($post->ID, 'sp_select', true); if (!$select) { global $pagenow; $select = 'post-new.php' ? 'auto' : 'manual'; } ?> <div> <?php foreach ($taxonomies as $taxonomy) { sp_taxonomy_field($taxonomy, $post, true); } ?> <p><strong> <?php _e('Teams', 'sportspress'); ?> </strong></p> <p class="sp-select-setting"> <select name="sp_select"> <option value="auto" <?php selected('auto', $select); ?> ><?php _e('Auto', 'sportspress'); ?> </option> <option value="manual" <?php selected('manual', $select); ?> ><?php _e('Manual', 'sportspress'); ?> </option> </select> </p> <?php sp_post_checklist($post->ID, 'sp_team', 'auto' == $select ? 'none' : 'block', array('sp_league', 'sp_season')); sp_post_adder('sp_team', __('Add New', 'sportspress')); ?> </div> <?php }
/** * Output the metabox */ public static function output($post) { $limit = get_option('prosports_event_teams', 2); $teams = (array) get_post_meta($post->ID, 'sp_team', false); $league_id = sp_get_the_term_id($post->ID, 'sp_league', 0); $season_id = sp_get_the_term_id($post->ID, 'sp_season', 0); for ($i = 0; $i < $limit; $i++) { $team = array_shift($teams); ?> <div class="sp-instance"> <p class="sp-tab-select sp-tab-select-dummy"> <?php $args = array('taxonomy' => 'sp_league', 'name' => 'sp_league_dummy', 'class' => 'sp-dummy sp_league-dummy', 'show_option_all' => __('All', 'prosports'), 'selected' => $league_id, 'values' => 'term_id'); sp_dropdown_taxonomies($args); ?> </p> <p class="sp-tab-select sp-tab-select-dummy"> <?php $args = array('taxonomy' => 'sp_season', 'name' => 'sp_season_dummy', 'class' => 'sp-dummy sp_season-dummy', 'show_option_all' => __('All', 'prosports'), 'selected' => $season_id, 'values' => 'term_id'); sp_dropdown_taxonomies($args); ?> </p> <p class="sp-tab-select sp-title-generator"> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'class' => 'prosports-pages', 'show_option_none' => __('— None —', 'prosports'), 'show_option_all' => __('— Individual —', 'prosports'), 'values' => 'ID', 'selected' => $team); sp_dropdown_pages($args); ?> </p> <ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar"> <li class="wp-tab-active"><a href="#sp_player-all"><?php _e('Players', 'prosports'); ?> </a></li> <li class="wp-tab"><a href="#sp_staff-all"><?php _e('Staff', 'prosports'); ?> </a></li> </ul> <?php sp_post_checklist($post->ID, 'sp_player', 'block', array('sp_league', 'sp_season', 'sp_current_team'), $i); sp_post_checklist($post->ID, 'sp_staff', 'none', array('sp_league', 'sp_season', 'sp_current_team'), $i); ?> </div> <?php } }
/** * Output the metabox */ public static function output($post) { wp_nonce_field('prosports_save_data', 'prosports_meta_nonce'); $league_id = sp_get_the_term_id($post->ID, 'sp_league', 0); $season_id = sp_get_the_term_id($post->ID, 'sp_season', 0); ?> <div> <p><strong><?php _e('Competition', 'prosports'); ?> </strong></p> <p class="sp-tab-select"> <?php $args = array('taxonomy' => 'sp_league', 'name' => 'sp_league', 'show_option_all' => __('All', 'prosports'), 'selected' => $league_id, 'values' => 'term_id'); if (!sp_dropdown_taxonomies($args)) { sp_taxonomy_adder('sp_league', 'sp_team', __('Add New', 'prosports')); } ?> </p> <p><strong><?php _e('Season', 'prosports'); ?> </strong></p> <p class="sp-tab-select"> <?php $args = array('taxonomy' => 'sp_season', 'name' => 'sp_season', 'show_option_all' => __('All', 'prosports'), 'selected' => $season_id, 'values' => 'term_id'); if (!sp_dropdown_taxonomies($args)) { sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'prosports')); } ?> </p> <p><strong><?php _e('Teams', 'prosports'); ?> </strong></p> <?php sp_post_checklist($post->ID, 'sp_team', 'block', array('sp_league', 'sp_season')); sp_post_adder('sp_team', __('Add New', 'prosports')); ?> </div> <?php }
function prosports_post_checklist($post_id = null, $meta = 'post', $display = 'block', $filter = null, $index = null) { return sp_post_checklist($post_id, $meta, $display, $filter, $index); }
/** * Output the metabox */ public static function output($post) { $limit = get_option('sportspress_event_teams', 2); $teams = (array) get_post_meta($post->ID, 'sp_team', false); for ($i = 0; $i < $limit; $i++) { $team = array_shift($teams); ?> <div class="sp-instance"> <p class="sp-tab-select sp-title-generator"> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'class' => 'sportspress-pages', 'show_option_none' => __('— None —', 'sportspress'), 'values' => 'ID', 'selected' => $team, 'chosen' => true, 'tax_query' => array()); if ('yes' == get_option('sportspress_event_filter_teams_by_league', 'no')) { $league_id = sp_get_the_term_id($post->ID, 'sp_league', 0); if ($league_id) { $args['tax_query'][] = array('taxonomy' => 'sp_league', 'terms' => $league_id); } } if ('yes' == get_option('sportspress_event_filter_teams_by_season', 'no')) { $season_id = sp_get_the_term_id($post->ID, 'sp_season', 0); if ($season_id) { $args['tax_query'][] = array('taxonomy' => 'sp_season', 'terms' => $season_id); } } if (!sp_dropdown_pages($args)) { unset($args['tax_query']); sp_dropdown_pages($args); } ?> </p> <?php $tabs = apply_filters('sportspress_event_team_tabs', array('sp_player', 'sp_staff')); ?> <?php if ($tabs) { ?> <ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar"> <?php foreach ($tabs as $index => $post_type) { $object = get_post_type_object($post_type); ?> <li class="wp-tab<?php if (0 == $index) { ?> -active<?php } ?> "><a href="#<?php echo $post_type; ?> -all"><?php echo $object->labels->name; ?> </a></li> <?php } ?> </ul> <?php foreach ($tabs as $index => $post_type) { sp_post_checklist($post->ID, $post_type, 0 == $index ? 'block' : 'none', array('sp_league', 'sp_season', 'sp_current_team'), $i); } ?> <?php } ?> </div> <?php } }
/** * Output the metabox */ public static function output($post) { $taxonomies = get_object_taxonomies('sp_list'); $team_id = get_post_meta($post->ID, 'sp_team', true); $grouping = get_post_meta($post->ID, 'sp_grouping', true); $orderby = get_post_meta($post->ID, 'sp_orderby', true); $order = get_post_meta($post->ID, 'sp_order', true); $select = get_post_meta($post->ID, 'sp_select', true); if (!$select) { global $pagenow; $select = 'post-new.php' == $pagenow ? 'auto' : 'manual'; } ?> <div> <?php foreach ($taxonomies as $taxonomy) { sp_taxonomy_field($taxonomy, $post, true); } ?> <?php if (apply_filters('sportspress_list_team_selector', true)) { ?> <p><strong><?php _e('Team', 'sportspress'); ?> </strong></p> <p class="sp-tab-select"> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team', 'show_option_all' => __('All', 'sportspress'), 'selected' => $team_id, 'values' => 'ID'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'sportspress')); } ?> </p> <?php } ?> <p><strong><?php _e('Grouping', 'sportspress'); ?> </strong></p> <p> <select name="sp_grouping"> <option value="0"><?php _e('None', 'sportspress'); ?> </option> <option value="position" <?php selected($grouping, 'position'); ?> ><?php _e('Position', 'sportspress'); ?> </option> </select> </p> <p><strong><?php _e('Sort by', 'sportspress'); ?> </strong></p> <p> <?php $args = array('prepend_options' => array('number' => __('Squad Number', 'sportspress'), 'name' => __('Name', 'sportspress')), 'post_type' => array('sp_performance', 'sp_metric', 'sp_statistic'), 'name' => 'sp_orderby', 'selected' => $orderby, 'values' => 'slug'); sp_dropdown_pages($args); ?> </p> <p><strong><?php _e('Sort Order', 'sportspress'); ?> </strong></p> <p> <select name="sp_order"> <option value="ASC" <?php selected('ASC', $order); ?> ><?php _e('Ascending', 'sportspress'); ?> </option> <option value="DESC" <?php selected('DESC', $order); ?> ><?php _e('Descending', 'sportspress'); ?> </option> </select> </p> <p><strong><?php _e('Players', 'sportspress'); ?> </strong></p> <p class="sp-select-setting"> <select name="sp_select"> <option value="auto" <?php selected('auto', $select); ?> ><?php _e('Auto', 'sportspress'); ?> </option> <option value="manual" <?php selected('manual', $select); ?> ><?php _e('Manual', 'sportspress'); ?> </option> </select> </p> <?php sp_post_checklist($post->ID, 'sp_player', 'auto' == $select ? 'none' : 'block', array('sp_league', 'sp_season', 'sp_current_team')); sp_post_adder('sp_player', __('Add New', 'sportspress')); ?> </div> <?php }
/** * Output the metabox */ public static function output($post) { $league_id = sp_get_the_term_id($post->ID, 'sp_league', 0); $season_id = sp_get_the_term_id($post->ID, 'sp_season', 0); $team_id = get_post_meta($post->ID, 'sp_team', true); $grouping = get_post_meta($post->ID, 'sp_grouping', true); $orderby = get_post_meta($post->ID, 'sp_orderby', true); $order = get_post_meta($post->ID, 'sp_order', true); ?> <div> <p><strong><?php _e('Competition', 'prosports'); ?> </strong></p> <p class="sp-tab-select"> <?php $args = array('taxonomy' => 'sp_league', 'name' => 'sp_league', 'show_option_all' => __('All', 'prosports'), 'selected' => $league_id, 'values' => 'term_id'); if (!sp_dropdown_taxonomies($args)) { sp_taxonomy_adder('sp_league', 'sp_team', __('Add New', 'prosports')); } ?> </p> <p><strong><?php _e('Season', 'prosports'); ?> </strong></p> <p class="sp-tab-select"> <?php $args = array('taxonomy' => 'sp_season', 'name' => 'sp_season', 'show_option_all' => __('All', 'prosports'), 'selected' => $season_id, 'values' => 'term_id'); if (!sp_dropdown_taxonomies($args)) { sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'prosports')); } ?> </p> <p><strong><?php _e('Team', 'prosports'); ?> </strong></p> <p class="sp-tab-select"> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team', 'show_option_all' => __('All', 'prosports'), 'selected' => $team_id, 'values' => 'ID'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'prosports')); } ?> </p> <p><strong><?php _e('Grouping', 'prosports'); ?> </strong></p> <p> <select name="sp_grouping"> <option value="0"><?php _e('None', 'prosports'); ?> </option> <option value="position" <?php selected($grouping, 'position'); ?> ><?php _e('Position', 'prosports'); ?> </option> </select> </p> <p><strong><?php _e('Sort by', 'prosports'); ?> </strong></p> <p> <?php $args = array('prepend_options' => array('number' => __('Number', 'prosports'), 'name' => __('Name', 'prosports')), 'post_type' => array('sp_performance', 'sp_metric', 'sp_statistic'), 'name' => 'sp_orderby', 'selected' => $orderby, 'values' => 'slug'); sp_dropdown_pages($args); ?> </p> <p><strong><?php _e('Sort Order', 'prosports'); ?> </strong></p> <p> <select name="sp_order"> <option value="ASC" <?php selected('ASC', $order); ?> ><?php _e('Ascending', 'prosports'); ?> </option> <option value="DESC" <?php selected('DESC', $order); ?> ><?php _e('Descending', 'prosports'); ?> </option> </select> </p> <p><strong><?php _e('Players', 'prosports'); ?> </strong></p> <?php sp_post_checklist($post->ID, 'sp_player', 'block', array('sp_league', 'sp_season', 'sp_current_team')); sp_post_adder('sp_player', __('Add New', 'prosports')); ?> </div> <?php }