/** * Output the metabox */ public static function output($post) { $taxonomies = get_object_taxonomies('sp_event'); $minutes = get_post_meta($post->ID, 'sp_minutes', true); ?> <?php do_action('sportspress_event_details_meta_box', $post); ?> <div class="sp-event-minutes-field"> <p><strong><?php _e('Full Time', 'sportspress'); ?> </strong></p> <p> <input name="sp_minutes" type="number" step="1" min="0" class="small-text" placeholder="<?php echo get_option('sportspress_event_minutes', 90); ?> " value="<?php echo esc_attr($minutes); ?> "> <?php _e('mins', 'sportspress'); ?> </p> </div> <?php foreach ($taxonomies as $taxonomy) { if ('sp_venue' == $taxonomy) { continue; } sp_taxonomy_field($taxonomy, $post, true, true); } ?> <div class="sp-event-sp_venue-field"> <p><strong><?php _e('Venue', 'sportspress'); ?> </strong></p> <p> <?php $terms = get_the_terms($post->ID, 'sp_venue'); $args = array('taxonomy' => 'sp_venue', 'name' => 'tax_input[sp_venue][]', 'class' => 'sp-has-dummy', 'selected' => sp_get_the_term_id_or_meta($post->ID, 'sp_venue'), 'values' => 'term_id', 'show_option_none' => __('— Not set —', 'sportspress'), 'chosen' => true); if (in_array('sp_venue', apply_filters('sportspress_event_auto_taxonomies', array('sp_venue')))) { $args['show_option_all'] = __('(Auto)', 'sportspress'); } if (!sp_dropdown_taxonomies($args)) { sp_taxonomy_adder('sp_venue', 'sp_event', __('Add New', 'sportspress')); } ?> </p> </div> <?php }
/** * Output the metabox */ public static function output($post) { $minutes = get_post_meta($post->ID, 'sp_minutes', true); $taxonomies = apply_filters('prosports_event_taxonomies', array('sp_league' => null, 'sp_season' => null, 'sp_venue' => 'sp_event')); ?> <div class="sp-event-minutes-field"> <p><strong><?php _e('Full Time', 'prosports'); ?> </strong></p> <p> <input name="sp_minutes" type="number" step="1" min="0" class="small-text" placeholder="<?php echo get_option('prosports_event_minutes', 90); ?> " value="<?php echo $minutes; ?> "> <?php _e('mins', 'prosports'); ?> </p> </div> <?php foreach ($taxonomies as $taxonomy => $post_type) { $obj = get_taxonomy($taxonomy); if ($obj) { ?> <div class="sp-event-<?php echo $taxonomy; ?> -field"> <p><strong><?php echo $obj->labels->singular_name; ?> </strong></p> <p> <?php $args = array('taxonomy' => $taxonomy, 'name' => $taxonomy, 'class' => 'sp-has-dummy', 'selected' => sp_get_the_term_id_or_meta($post->ID, $taxonomy), 'values' => 'term_id', 'show_option_none' => __('-- Not set --', 'prosports')); if (in_array($taxonomy, apply_filters('prosports_event_auto_taxonomies', array('sp_venue')))) { $args['show_option_all'] = __('(Auto)', 'prosports'); } if (!sp_dropdown_taxonomies($args)) { sp_taxonomy_adder($taxonomy, $post_type, $obj->labels->add_new_item); } ?> </p> </div> <?php } } }