/** * Output the metabox */ public static function output($post) { $metrics = get_post_meta($post->ID, 'sp_metrics', true); $args = array('post_type' => 'sp_metric', 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'); $vars = get_posts($args); if ($vars) { foreach ($vars as $var) { ?> <p><strong><?php echo $var->post_title; ?> </strong></p> <p><input type="text" name="sp_metrics[<?php echo $var->post_name; ?> ]" value="<?php echo esc_attr(sp_array_value($metrics, $var->post_name, '')); ?> " /></p> <?php } } else { sp_post_adder('sp_metric', __('Add New', 'sportspress')); } }
/** * 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 }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '')); $title = strip_tags($instance['title']); $id = intval($instance['id']); // Action to hook into do_action('sportspress_before_widget_template_form', $this, $instance, 'staff'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('Staff', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_staff', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_staff', __('Add New', 'sportspress')); } ?> </p> <?php // Action to hook into do_action('sportspress_after_widget_template_form', $this, $instance, 'staff'); }
/** * 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 form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => 5, 'show_all_staff_link' => true)); $title = strip_tags($instance['title']); $id = intval($instance['id']); $number = intval($instance['number']); $show_all_staff_link = $instance['show_all_staff_link']; // Action to hook into do_action('sportspress_before_widget_template_form', $this, $instance, 'staff-list'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('Staff Directory', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_directory', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_directory', __('Add New', 'sportspress')); } ?> </p> <p><label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of staff to show:', 'sportspress'); ?> </label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo esc_attr($number); ?> " size="3"></p> <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_staff_link'); ?> " name="<?php echo $this->get_field_name('show_all_staff_link'); ?> " value="1" <?php checked($show_all_staff_link, 1); ?> > <label for="<?php echo $this->get_field_id('show_all_staff_link'); ?> "><?php _e('Display link to view all staff', 'sportspress'); ?> </label></p> <?php // Action to hook into do_action('sportspress_after_widget_template_form', $this, $instance, 'staff-list'); }
function form($instance) { $defaults = apply_filters('sportspress_widget_defaults', array('title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true)); $instance = wp_parse_args((array) $instance, $defaults); $title = strip_tags($instance['title']); $id = intval($instance['id']); $caption = strip_tags($instance['caption']); $number = intval($instance['number']); $columns = $instance['columns']; $show_team_logo = $instance['show_team_logo']; $show_full_table_link = $instance['show_full_table_link']; // Action to hook into do_action('sportspress_before_widget_template_form', $this, $instance, 'league-table'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('caption'); ?> "><?php _e('Heading:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('caption'); ?> " name="<?php echo $this->get_field_name('caption'); ?> " type="text" value="<?php echo esc_attr($caption); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('League Table', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_table', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'show_option_none' => __('— Select —', 'sportspress'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_table', __('Add New', 'sportspress')); } ?> </p> <p><label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of teams to show:', 'sportspress'); ?> </label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo esc_attr($number); ?> " size="3"></p> <p class="sp-prefs"> <?php _e('Columns:', 'sportspress'); ?> <br> <?php $args = array('post_type' => 'sp_column', 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'); $the_columns = get_posts($args); $field_name = $this->get_field_name('columns') . '[]'; $field_id = $this->get_field_id('columns'); ?> <?php foreach ($the_columns as $column) { ?> <label class="button"><input name="<?php echo $field_name; ?> " type="checkbox" id="<?php echo $field_id . '-' . $column->post_name; ?> " value="<?php echo $column->post_name; ?> " <?php if ($columns === null || in_array($column->post_name, $columns)) { ?> checked="checked"<?php } ?> ><?php echo $column->post_title; ?> </label> <?php } ?> </p> <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_team_logo'); ?> " name="<?php echo $this->get_field_name('show_team_logo'); ?> " value="1" <?php checked($show_team_logo, 1); ?> > <label for="<?php echo $this->get_field_id('show_team_logo'); ?> "><?php _e('Display logos', 'sportspress'); ?> </label><br> <input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_full_table_link'); ?> " name="<?php echo $this->get_field_name('show_full_table_link'); ?> " value="1" <?php checked($show_full_table_link, 1); ?> > <label for="<?php echo $this->get_field_id('show_full_table_link'); ?> "><?php _e('Display link to view full table', 'sportspress'); ?> </label></p> <?php // Action to hook into do_action('sportspress_after_widget_template_form', $this, $instance, 'league-table'); }
/** * Output the metabox */ public static function output($post) { $status = get_post_meta($post->ID, 'sp_status', true); $date = get_post_meta($post->ID, 'sp_date', true); $date_from = get_post_meta($post->ID, 'sp_date_from', true); $date_to = get_post_meta($post->ID, 'sp_date_to', true); $league_id = sp_get_the_term_id($post->ID, 'sp_league', 0); $season_id = sp_get_the_term_id($post->ID, 'sp_season', 0); $venue_id = sp_get_the_term_id($post->ID, 'sp_venue', 0); $team_id = get_post_meta($post->ID, 'sp_team', true); $order = get_post_meta($post->ID, 'sp_order', true); ?> <div> <p><strong><?php _e('Status', 'prosports'); ?> </strong></p> <p> <?php $args = array('name' => 'sp_status', 'id' => 'sp_status', 'selected' => $status); sp_dropdown_statuses($args); ?> </p> <div class="sp-date-selector"> <p><strong><?php _e('Date', 'prosports'); ?> </strong></p> <p> <?php $args = array('name' => 'sp_date', 'id' => 'sp_date', 'selected' => $date); sp_dropdown_dates($args); ?> </p> <p class="sp-date-range"> <input type="text" class="sp-datepicker-from" name="sp_date_from" value="<?php echo $date_from ? $date_from : date_i18n('Y-m-d'); ?> " size="10"> : <input type="text" class="sp-datepicker-to" name="sp_date_to" value="<?php echo $date_to ? $date_to : date_i18n('Y-m-d'); ?> " size="10"> </p> </div> <p><strong><?php _e('Competition', 'prosports'); ?> </strong></p> <p> <?php $args = array('show_option_all' => __('All', 'prosports'), 'taxonomy' => 'sp_league', 'name' => 'sp_league', '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('show_option_all' => __('All', 'prosports'), 'taxonomy' => 'sp_season', 'name' => 'sp_season', '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('Venue', 'prosports'); ?> </strong></p> <p> <?php $args = array('show_option_all' => __('All', 'prosports'), 'taxonomy' => 'sp_venue', 'name' => 'sp_venue', 'selected' => $venue_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> <?php $args = array('show_option_all' => __('All', 'prosports'), 'post_type' => 'sp_team', 'name' => 'sp_team', 'selected' => $team_id, 'values' => 'ID'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'prosports')); } ?> </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> </div> <?php }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n('Y-m-d'), 'date_to' => date_i18n('Y-m-d'), 'show_all_events_link' => false)); $title = strip_tags($instance['title']); $id = intval($instance['id']); $status = $instance['status']; $date = $instance['date']; $date_from = $instance['date_from']; $date_to = $instance['date_to']; $show_all_events_link = $instance['show_all_events_link']; // Action to hook into do_action('prosports_before_widget_template_form', $this, $instance, 'event-calendar'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'prosports'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'prosports'), __('Calendar', 'prosports')); ?> </label> <?php $args = array('post_type' => 'sp_calendar', 'show_option_all' => __('All', 'prosports'), 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_calendar', __('Add New', 'prosports')); } ?> </p> <p><label for="<?php echo $this->get_field_id('status'); ?> "><?php _e('Status:', 'prosports'); ?> </label> <?php $args = array('show_option_default' => __('Default', 'prosports'), 'name' => $this->get_field_name('status'), 'id' => $this->get_field_id('status'), 'selected' => $status, 'class' => 'sp-event-status-select widefat'); sp_dropdown_statuses($args); ?> </p> <div class="sp-date-selector sp-event-calendar-show-all-toggle<?php if (!$id) { ?> hidden<?php } ?> "> <p><label for="<?php echo $this->get_field_id('date'); ?> "><?php _e('Date:', 'prosports'); ?> </label> <?php $args = array('show_option_default' => __('Default', 'prosports'), 'name' => $this->get_field_name('date'), 'id' => $this->get_field_id('date'), 'selected' => $date, 'class' => 'sp-event-date-select widefat'); sp_dropdown_dates($args); ?> </p> <p class="sp-date-range<?php if ('range' !== $date) { ?> hidden<?php } ?> "> <input type="text" name="<?php echo $this->get_field_name('date_from'); ?> " value="<?php echo $date_from; ?> " placeholder="yyyy-mm-dd" size="10"> : <input type="text" name="<?php echo $this->get_field_name('date_to'); ?> " value="<?php echo $date_to; ?> " placeholder="yyyy-mm-dd" size="10"> </p> </div> <p class="sp-event-calendar-show-all-toggle<?php if (!$id) { ?> hidden<?php } ?> "><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?> " name="<?php echo $this->get_field_name('show_all_events_link'); ?> " value="1" <?php checked($show_all_events_link, 1); ?> > <label for="<?php echo $this->get_field_id('show_all_events_link'); ?> "><?php _e('Display link to view all events', 'prosports'); ?> </label></p> <?php // Action to hook into do_action('prosports_after_widget_template_form', $this, $instance, 'event-calendar'); }
/** * Output the metabox */ public static function output($post) { $taxonomies = get_object_taxonomies('sp_calendar'); $caption = get_post_meta($post->ID, 'sp_caption', true); $status = get_post_meta($post->ID, 'sp_status', true); $date = get_post_meta($post->ID, 'sp_date', true); $date_from = get_post_meta($post->ID, 'sp_date_from', true); $date_to = get_post_meta($post->ID, 'sp_date_to', true); $day = get_post_meta($post->ID, 'sp_day', true); $teams = get_post_meta($post->ID, 'sp_team', false); $table_id = get_post_meta($post->ID, 'sp_table', true); $orderby = get_post_meta($post->ID, 'sp_orderby', true); $order = get_post_meta($post->ID, 'sp_order', true); ?> <div> <p><strong><?php _e('Heading', 'sportspress'); ?> </strong></p> <p><input type="text" id="sp_caption" name="sp_caption" value="<?php echo esc_attr($caption); ?> " placeholder="<?php echo esc_attr(get_the_title()); ?> "></p> <p><strong><?php _e('Status', 'sportspress'); ?> </strong></p> <p> <?php $args = array('name' => 'sp_status', 'id' => 'sp_status', 'selected' => $status); sp_dropdown_statuses($args); ?> </p> <div class="sp-date-selector"> <p><strong><?php _e('Date', 'sportspress'); ?> </strong></p> <p> <?php $args = array('name' => 'sp_date', 'id' => 'sp_date', 'selected' => $date); sp_dropdown_dates($args); ?> </p> <p class="sp-date-range"> <input type="text" class="sp-datepicker-from" name="sp_date_from" value="<?php echo $date_from ? $date_from : date_i18n('Y-m-d'); ?> " size="10"> : <input type="text" class="sp-datepicker-to" name="sp_date_to" value="<?php echo $date_to ? $date_to : date_i18n('Y-m-d'); ?> " size="10"> </p> </div> <div class="sp-event-day-field"> <p><strong><?php _e('Match Day', 'sportspress'); ?> </strong></p> <p> <input name="sp_day" type="text" class="medium-text" placeholder="<?php _e('All', 'sportspress'); ?> " value="<?php echo esc_attr($day); ?> "> </p> </div> <?php foreach ($taxonomies as $taxonomy) { sp_taxonomy_field($taxonomy, $post, true); } ?> <p><strong><?php _e('Team', 'sportspress'); ?> </strong></p> <p> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'selected' => $teams, 'values' => 'ID', 'class' => 'widefat', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('All', 'sportspress')); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'sportspress')); } ?> </p> <p><strong><?php _e('Sort by', 'sportspress'); ?> </strong></p> <p> <select name="sp_orderby"> <option value="date" <?php selected('date', $orderby); ?> ><?php _e('Date', 'sportspress'); ?> </option> <option value="day" <?php selected('day', $orderby); ?> ><?php _e('Match Day', 'sportspress'); ?> </option> </select> </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> </div> <?php }
/** * Output the details metabox */ public static function details($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); ?> <div> <p><strong><?php _e('Competition', 'prosports'); ?> </strong></p> <p> <?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> </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 details metabox */ public static function details($post) { $taxonomies = get_object_taxonomies('sp_directory'); $team_id = get_post_meta($post->ID, 'sp_team', true); ?> <div> <?php foreach ($taxonomies as $taxonomy) { sp_taxonomy_field($taxonomy, $post, 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> </div> <?php }
/** * 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); if ($limit) { 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) { do_action('sportspress_event_teams_meta_box_checklist', $post->ID, $post_type, 0 == $index ? 'block' : 'none', $team, $i); if (apply_filters('sportspress_event_teams_meta_box_default_checklist', true)) { sp_post_checklist($post->ID, $post_type, 0 == $index ? 'block' : 'none', array('sp_league', 'sp_season', 'sp_current_team'), $i); } } ?> <?php } ?> </div> <?php } } else { ?> <p><strong><?php printf(__('Select %s:', 'sportspress'), __('Teams', 'sportspress')); ?> </strong></p> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'selected' => $teams, 'values' => 'ID', 'class' => 'widefat', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('None', 'sportspress')); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'sportspress')); } } wp_nonce_field('sp-get-players', 'sp-get-players-nonce', false); }
/** * 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 }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n('Y-m-d'), 'date_to' => date_i18n('Y-m-d'), 'day' => '', 'number' => 5, 'order' => 'default', 'show_all_events_link' => true)); $title = strip_tags($instance['title']); $id = intval($instance['id']); $caption = strip_tags($instance['caption']); $status = $instance['status']; $date = $instance['date']; $date_from = $instance['date_from']; $date_to = $instance['date_to']; $day = $instance['day']; $number = intval($instance['number']); $order = strip_tags($instance['order']); $show_all_events_link = $instance['show_all_events_link']; // Action to hook into do_action('sportspress_before_widget_template_form', $this, $instance, 'event-blocks'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('caption'); ?> "><?php _e('Heading:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('caption'); ?> " name="<?php echo $this->get_field_name('caption'); ?> " type="text" value="<?php echo esc_attr($caption); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('Calendar', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_calendar', 'show_option_all' => __('All', 'sportspress'), 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_calendar', __('Add New', 'sportspress')); } ?> </p> <p><label for="<?php echo $this->get_field_id('status'); ?> "><?php _e('Status:', 'sportspress'); ?> </label> <?php $args = array('show_option_default' => __('Default', 'sportspress'), 'name' => $this->get_field_name('status'), 'id' => $this->get_field_id('status'), 'selected' => $status, 'class' => 'sp-event-status-select widefat'); sp_dropdown_statuses($args); ?> </p> <div class="sp-date-selector"> <p><label for="<?php echo $this->get_field_id('date'); ?> "><?php _e('Date:', 'sportspress'); ?> </label> <?php $args = array('show_option_default' => __('Default', 'sportspress'), 'name' => $this->get_field_name('date'), 'id' => $this->get_field_id('date'), 'selected' => $date, 'class' => 'sp-event-date-select widefat'); sp_dropdown_dates($args); ?> </p> <p class="sp-date-range<?php if ('range' !== $date) { ?> hidden<?php } ?> "> <input type="text" name="<?php echo $this->get_field_name('date_from'); ?> " value="<?php echo $date_from; ?> " placeholder="yyyy-mm-dd" size="10"> : <input type="text" name="<?php echo $this->get_field_name('date_to'); ?> " value="<?php echo $date_to; ?> " placeholder="yyyy-mm-dd" size="10"> </p> </div> <p><label for="<?php echo $this->get_field_id('day'); ?> "><?php _e('Match Day:', 'sportspress'); ?> </label> <input id="<?php echo $this->get_field_id('day'); ?> " name="<?php echo $this->get_field_name('day'); ?> " type="text" placeholder="<?php _e('All', 'sportspress'); ?> " value="<?php echo esc_attr($day); ?> " size="10"></p> <p><label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of events to show:', 'sportspress'); ?> </label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo esc_attr($number); ?> " size="3"></p> <p><label for="<?php echo $this->get_field_id('order'); ?> "><?php _e('Sort Order:', 'sportspress'); ?> </label> <select name="<?php echo $this->get_field_name('order'); ?> " id="<?php echo $this->get_field_id('order'); ?> " class="sp-select-order widefat"> <option value="default" <?php selected('default', $order); ?> ><?php _e('Default', 'sportspress'); ?> </option> <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 class="sp-event-calendar-show-all-toggle<?php if (!$id) { ?> hidden<?php } ?> "><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?> " name="<?php echo $this->get_field_name('show_all_events_link'); ?> " value="1" <?php checked($show_all_events_link, 1); ?> > <label for="<?php echo $this->get_field_id('show_all_events_link'); ?> "><?php _e('Display link to view all events', 'sportspress'); ?> </label></p> <?php // Action to hook into do_action('sportspress_after_widget_template_form', $this, $instance, 'event-blocks'); }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => 2, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true)); $title = strip_tags($instance['title']); $id = intval($instance['id']); $caption = strip_tags($instance['caption']); $number = intval($instance['number']); $columns = intval($instance['columns']); $orderby = strip_tags($instance['orderby']); $order = strip_tags($instance['order']); $show_all_players_link = $instance['show_all_players_link']; // Action to hook into do_action('sportspress_before_widget_template_form', $this, $instance, 'player-gallery'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('caption'); ?> "><?php _e('Heading:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('caption'); ?> " name="<?php echo $this->get_field_name('caption'); ?> " type="text" value="<?php echo esc_attr($caption); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('Player List', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_list', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_list', __('Add New', 'sportspress')); } ?> </p> <p><label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of players to show:', 'sportspress'); ?> </label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo esc_attr($number); ?> " size="3"></p> <p><label for="<?php echo $this->get_field_id('columns'); ?> "><?php _e('Columns:', 'sportspress'); ?> </label> <input id="<?php echo $this->get_field_id('columns'); ?> " name="<?php echo $this->get_field_name('columns'); ?> " type="text" value="<?php echo esc_attr($columns); ?> " size="3"></p> <p><label for="<?php echo $this->get_field_id('orderby'); ?> "><?php _e('Sort by:', 'sportspress'); ?> </label> <?php $args = array('prepend_options' => array('default' => __('Default', 'sportspress'), 'number' => __('Squad Number', 'sportspress'), 'name' => __('Name', 'sportspress'), 'eventsplayed' => __('Played', 'sportspress')), 'append_options' => array('rand' => __('Random', 'sportspress')), 'post_type' => 'sp_performance', 'name' => $this->get_field_name('orderby'), 'id' => $this->get_field_id('orderby'), 'selected' => $orderby, 'values' => 'slug', 'class' => 'sp-select-orderby widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_list', __('Add New', 'sportspress')); } ?> </p> <p><label for="<?php echo $this->get_field_id('order'); ?> "><?php _e('Sort Order:', 'sportspress'); ?> </label> <select name="<?php echo $this->get_field_name('order'); ?> " id="<?php echo $this->get_field_id('order'); ?> " class="sp-select-order widefat" <?php disabled($orderby, 'default'); ?> > <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><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_players_link'); ?> " name="<?php echo $this->get_field_name('show_all_players_link'); ?> " value="1" <?php checked($show_all_players_link, 1); ?> > <label for="<?php echo $this->get_field_id('show_all_players_link'); ?> "><?php _e('Display link to view all players', 'sportspress'); ?> </label></p> <?php // Action to hook into do_action('sportspress_after_widget_template_form', $this, $instance, 'player-gallery'); }
function prosports_post_adder($post_type = 'post', $label = null) { return sp_post_adder($post_type, $label); }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => 5, 'columns' => null, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true)); $title = strip_tags($instance['title']); $id = intval($instance['id']); $number = intval($instance['number']); $columns = $instance['columns']; $orderby = strip_tags($instance['orderby']); $order = strip_tags($instance['order']); $show_all_players_link = $instance['show_all_players_link']; // Action to hook into do_action('prosports_before_widget_template_form', $this, $instance, 'player-list'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'prosports'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'prosports'), __('Player List', 'prosports')); ?> </label> <?php $args = array('post_type' => 'sp_list', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_list', __('Add New', 'prosports')); } ?> </p> <p><label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of players to show:', 'prosports'); ?> </label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo esc_attr($number); ?> " size="3"></p> <p class="sp-prefs"> <?php _e('Performance:', 'prosports'); ?> <br> <?php $args = array('post_type' => array('sp_metric', 'sp_performance', 'sp_statistic'), 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'); $the_columns = get_posts($args); $field_name = $this->get_field_name('columns') . '[]'; $field_id = $this->get_field_id('columns'); ?> <?php foreach ($the_columns as $column) { ?> <label class="button"><input name="<?php echo $field_name; ?> " type="checkbox" id="<?php echo $field_id . '-' . $column->post_name; ?> " value="<?php echo $column->post_name; ?> " <?php if ($columns === null || in_array($column->post_name, $columns)) { ?> checked="checked"<?php } ?> ><?php echo $column->post_title; ?> </label> <?php } ?> </p> <p><label for="<?php echo $this->get_field_id('orderby'); ?> "><?php _e('Sort by:', 'prosports'); ?> </label> <?php $args = array('prepend_options' => array('default' => __('Default', 'prosports'), 'number' => __('Number', 'prosports'), 'name' => __('Name', 'prosports'), 'eventsplayed' => __('Played', 'prosports')), 'post_type' => array('sp_metric', 'sp_performance', 'sp_statistic'), 'name' => $this->get_field_name('orderby'), 'id' => $this->get_field_id('orderby'), 'selected' => $orderby, 'values' => 'slug', 'class' => 'sp-select-orderby widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_list', __('Add New', 'prosports')); } ?> </p> <p><label for="<?php echo $this->get_field_id('order'); ?> "><?php _e('Sort Order:', 'prosports'); ?> </label> <select name="<?php echo $this->get_field_name('order'); ?> " id="<?php echo $this->get_field_id('order'); ?> " class="sp-select-order widefat" <?php disabled($orderby, 'default'); ?> > <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><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_players_link'); ?> " name="<?php echo $this->get_field_name('show_all_players_link'); ?> " value="1" <?php checked($show_all_players_link, 1); ?> > <label for="<?php echo $this->get_field_id('show_all_players_link'); ?> "><?php _e('Display link to view all players', 'prosports'); ?> </label></p> <?php // Action to hook into do_action('prosports_after_widget_template_form', $this, $instance, 'player-list'); }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false)); $title = strip_tags($instance['title']); $caption = strip_tags($instance['caption']); $team = intval($instance['team']); $id = intval($instance['id']); $show_venue = intval($instance['show_venue']); $show_league = intval($instance['show_league']); // Action to hook into do_action('sportspress_before_widget_template_form', $this, $instance, 'countdown'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('caption'); ?> "><?php _e('Heading:', 'sportspress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('caption'); ?> " name="<?php echo $this->get_field_name('caption'); ?> " type="text" value="<?php echo esc_attr($caption); ?> " /></p> <p class="sp-dropdown-filter"><label for="<?php echo $this->get_field_id('team'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('Team', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_team', 'name' => $this->get_field_name('team'), 'id' => $this->get_field_id('team'), 'selected' => $team, 'show_option_all' => __('All', 'sportspress'), 'values' => 'ID', 'class' => 'widefat'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'sportspress')); } ?> </p> <p class="sp-dropdown-target"><label for="<?php echo $this->get_field_id('id'); ?> "><?php printf(__('Select %s:', 'sportspress'), __('Event', 'sportspress')); ?> </label> <?php $args = array('post_type' => 'sp_event', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'show_option_all' => __('(Auto)', 'sportspress'), 'values' => 'ID', 'class' => 'widefat', 'show_dates' => true, 'post_status' => 'future', 'filter' => 'sp_team'); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_event', __('Add New', 'sportspress')); } ?> </p> <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_venue'); ?> " name="<?php echo $this->get_field_name('show_venue'); ?> " value="1" <?php checked($show_venue, 1); ?> > <label for="<?php echo $this->get_field_id('show_venue'); ?> "><?php _e('Display venue', 'sportspress'); ?> </label></p> <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_league'); ?> " name="<?php echo $this->get_field_name('show_league'); ?> " value="1" <?php checked($show_league, 1); ?> > <label for="<?php echo $this->get_field_id('show_league'); ?> "><?php _e('Display competition', 'sportspress'); ?> </label></p> <?php // Action to hook into do_action('sportspress_after_widget_template_form', $this, $instance, 'countdown'); }
/** * 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); if ($limit) { 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 = array(); $sections = get_option('sportspress_event_performance_sections', -1); if (0 == $sections) { $tabs['sp_offense'] = array('label' => __('Offense', 'sportspress'), 'post_type' => 'sp_player'); $tabs['sp_defense'] = array('label' => __('Defense', 'sportspress'), 'post_type' => 'sp_player'); } elseif (1 == $sections) { $tabs['sp_defense'] = array('label' => __('Defense', 'sportspress'), 'post_type' => 'sp_player'); $tabs['sp_offense'] = array('label' => __('Offense', 'sportspress'), 'post_type' => 'sp_player'); } else { $tabs['sp_player'] = array('label' => __('Players', 'sportspress'), 'post_type' => 'sp_player'); } $tabs['sp_staff'] = array('label' => __('Staff', 'sportspress'), 'post_type' => 'sp_staff'); ?> <?php if ($tabs) { ?> <ul id="sp_team-tabs" class="sp-tab-bar category-tabs"> <?php $j = 0; foreach ($tabs as $slug => $tab) { ?> <li class="<?php if (0 == $j) { ?> tabs<?php } ?> "><a href="#<?php echo $slug; ?> -all"><?php echo $tab['label']; ?> </a></li> <?php $j++; } ?> </ul> <?php $j = 0; foreach ($tabs as $slug => $tab) { do_action('sportspress_event_teams_meta_box_checklist', $post->ID, $tab['post_type'], 0 == $j ? 'block' : 'none', $team, $i, $slug); $j++; } ?> <?php } ?> </div> <?php } } else { ?> <p><strong><?php printf(__('Select %s:', 'sportspress'), __('Teams', 'sportspress')); ?> </strong></p> <?php $args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'selected' => $teams, 'values' => 'ID', 'class' => 'widefat', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('None', 'sportspress')); if (!sp_dropdown_pages($args)) { sp_post_adder('sp_team', __('Add New', 'sportspress')); } } wp_nonce_field('sp-get-players', 'sp-get-players-nonce', false); }