Adjustments to event importer

This commit is contained in:
Brian Miyaji
2014-03-15 19:51:03 +11:00
parent f9ae46f9ce
commit a7df2745e1
27 changed files with 83 additions and 135 deletions

View File

@@ -61,13 +61,13 @@ function sportspress_event_meta_init( $post ) {
}
function sportspress_event_format_meta( $post ) {
$format = get_post_meta( $post->ID, 'sp_format', true );
global $sportspress_formats;
$the_format = get_post_meta( $post->ID, 'sp_format', true );
?>
<div id="post-formats-select">
<input type="radio" name="sp_format" class="post-format" id="post-format-league" value="league" <?php checked( true, ! $format || $format == 'league' ); ?>> <label for="post-format-league" class="post-format-icon post-format-league">League</label>
<br><input type="radio" name="sp_format" class="post-format" id="post-format-tournament" value="tournament" <?php checked( 'tournament', $format ); ?>> <label for="post-format-tournament" class="post-format-icon post-format-tournament">Tournament</label>
<br><input type="radio" name="sp_format" class="post-format" id="post-format-friendly" value="friendly" <?php checked( 'friendly', $format ); ?>> <label for="post-format-friendly" class="post-format-icon post-format-friendly">Friendly</label>
<br>
<?php foreach ( $sportspress_formats['event'] as $key => $format ): ?>
<input type="radio" name="sp_format" class="post-format" id="post-format-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( true, ( $key == 'league' && ! $the_format ) || $the_format == $key ); ?>> <label for="post-format-<?php echo $key; ?>" class="post-format-icon post-format-<?php echo $key; ?>"><?php echo $format; ?></label><br>
<?php endforeach; ?>
</div>
<?php
}
@@ -76,11 +76,10 @@ function sportspress_event_details_meta( $post ) {
$type = sportspress_get_the_term_id( $post->ID, 'sp_type', null );
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 );
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
$tournament_id = sportspress_get_the_term_id( $post->ID, 'sp_tournament', 0 );
$venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 );
?>
<div>
<fieldset class="sp-event-format-field sp-league-event-field sp-league-event-field">
<fieldset class="sp-event-format-field sp-league-event-field sp-friendly-event-field">
<p><strong><?php _e( 'League', 'sportspress' ); ?></strong></p>
<p>
<?php
@@ -112,23 +111,6 @@ function sportspress_event_details_meta( $post ) {
?>
</p>
</fieldset>
<fieldset class="sp-event-format-field sp-tournament-event-field">
<p><strong><?php _e( 'Tournament', 'sportspress' ); ?></strong></p>
<p>
<?php
$args = array(
'taxonomy' => 'sp_tournament',
'name' => 'sp_tournament',
'selected' => $tournament_id,
'values' => 'term_id',
'show_option_none' => __( '-- Not set --', 'sportspress' ),
);
if ( ! sportspress_dropdown_taxonomies( $args ) ):
sportspress_taxonomy_adder( 'sp_tournament', 'sp_team', __( 'Add New', 'sportspress' ) );
endif;
?>
</p>
</fieldset>
<p><strong><?php _e( 'Venue', 'sportspress' ); ?></strong></p>
<p>
<?php

View File

@@ -58,13 +58,13 @@ function sportspress_list_meta_init( $post ) {
}
function sportspress_list_format_meta( $post ) {
$format = get_post_meta( $post->ID, 'sp_format', true );
global $sportspress_formats;
$the_format = get_post_meta( $post->ID, 'sp_format', true );
?>
<div id="post-formats-select">
<input type="radio" name="sp_format" class="post-format" id="post-format-list" value="list" <?php checked( true, ! $format || $format == 'list' ); ?>> <label for="post-format-list" class="post-format-icon post-format-list"><?php _e( 'List', 'sportspress' ); ?></label>
<br><input type="radio" name="sp_format" class="post-format" id="post-format-roster" value="roster" <?php checked( 'roster', $format ); ?>> <label for="post-format-roster" class="post-format-icon post-format-roster"><?php _e( 'Roster', 'sportspress' ); ?></label>
<br><input type="radio" name="sp_format" class="post-format" id="post-format-gallery" value="gallery" <?php checked( 'gallery', $format ); ?>> <label for="post-format-gallery" class="post-format-icon post-format-gallery"><?php _e( 'Gallery', 'sportspress' ); ?></label>
<br>
<?php foreach ( $sportspress_formats['list'] as $key => $format ): ?>
<input type="radio" name="sp_format" class="post-format" id="post-format-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( true, ( $key == 'list' && ! $the_format ) || $the_format == $key ); ?>> <label for="post-format-<?php echo $key; ?>" class="post-format-icon post-format-<?php echo $key; ?>"><?php echo $format; ?></label><br>
<?php endforeach; ?>
</div>
<?php
}

View File

@@ -1,42 +0,0 @@
<?php
function sportspress_sponsor_post_init() {
$labels = array(
'name' => __( 'Sponsors', 'sportspress' ),
'singular_name' => __( 'Sponsor', 'sportspress' ),
'add_new_item' => __( 'Add New Sponsor', 'sportspress' ),
'edit_item' => __( 'Edit Sponsor', 'sportspress' ),
'new_item' => __( 'New', 'sportspress' ),
'view_item' => __( 'View', 'sportspress' ),
'search_items' => __( 'Search', 'sportspress' ),
'not_found' => __( 'No results found.', 'sportspress' ),
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
);
$args = array(
'label' => __( 'Sponsors', 'sportspress' ),
'labels' => $labels,
'public' => true,
'has_archive' => false,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'author', 'thumbnail' ),
'register_meta_box_cb' => 'sportspress_sponsor_meta_init',
'rewrite' => array( 'slug' => get_option( 'sp_sponsor_slug', 'sponsor' ) ),
'menu_icon' => 'dashicons-portfolio',
'capability_type' => 'sp_sponsor'
);
register_post_type( 'sp_sponsor', $args );
}
add_action( 'init', 'sportspress_sponsor_post_init' );
function sportspress_sponsor_meta_init() {
}
function sportspress_sponsor_edit_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'sp_icon' => '&nbsp;',
'title' => __( 'Name', 'sportspress' ),
'sp_views' => __( 'Views', 'sportspress' ),
);
return $columns;
}
add_filter( 'manage_edit-sp_sponsor_columns', 'sportspress_sponsor_edit_columns' );

View File

@@ -21,7 +21,6 @@ function sportspress_staff_post_init() {
'register_meta_box_cb' => 'sportspress_staff_meta_init',
'rewrite' => array( 'slug' => get_option( 'sp_staff_slug', 'staff' ) ),
'show_in_menu' => 'edit.php?post_type=sp_player',
'menu_icon' => 'dashicons-businessman',
'capability_type' => 'sp_staff'
);
register_post_type( 'sp_staff', $args );