Initialize directory post type and tag 0.5

This commit is contained in:
Brian Miyaji
2014-03-18 01:03:06 +11:00
parent b885665f21
commit 1aa1cb56ec
6 changed files with 194 additions and 17 deletions

View File

@@ -9,6 +9,8 @@ function sportspress_admin_head() {
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' ); sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' );
elseif ( $typenow == 'sp_staff' ) elseif ( $typenow == 'sp_staff' )
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_staff' ); sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_staff' );
elseif ( $typenow == 'sp_directory' )
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_directory' );
} }
add_action( 'admin_head-edit.php', 'sportspress_admin_head', 10, 2 ); add_action( 'admin_head-edit.php', 'sportspress_admin_head', 10, 2 );
add_action( 'admin_head-post.php', 'sportspress_admin_head', 10, 2 ); add_action( 'admin_head-post.php', 'sportspress_admin_head', 10, 2 );

View File

@@ -7,6 +7,7 @@ function sportspress_admin_init() {
'sp_player', 'sp_player',
'sp_list', 'sp_list',
'sp_staff', 'sp_staff',
'sp_directory',
'sp_config', 'sp_config',
); );

View File

@@ -1,11 +0,0 @@
<?php
function sportspress_media_buttons() {
//if ( ! in_array( array('post.php', 'page.php', 'page-new.php', 'post-new.php')
?>
<a href="#TB_inline?width=480&inlineId=select_sp_table" class="thickbox button sp-insert sp-insert-map" id="add_gform" title="<?php _e( 'Add Map', 'sportspress' ); ?>"><span class="sp-buttons-icon sp-map-buttons-icon "></span> <?php _e( 'Add Map', 'sportspress' ); ?></a>
<a href="#TB_inline?width=480&inlineId=select_sp_table" class="thickbox button sp-insert sp-insert-table" id="add_gform" title="<?php _e( 'Add League Table', 'sportspress' ); ?>"><span class="sp-buttons-icon sp-table-buttons-icon "></span> <?php _e( 'Add League Table', 'sportspress' ); ?></a>
<?php
}
add_action( 'media_buttons', 'sportspress_media_buttons', 20 );

View File

@@ -0,0 +1,165 @@
<?php
function sportspress_directory_post_init() {
$labels = array(
'name' => __( 'Directories', 'sportspress' ),
'singular_name' => __( 'Directory', 'sportspress' ),
'add_new_item' => __( 'Add New Directory', 'sportspress' ),
'edit_item' => __( 'Edit Directory', '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' => __( 'Directories', 'sportspress' ),
'labels' => $labels,
'public' => true,
'has_archive' => false,
'hierarchical' => false,
'supports' => array( 'title', 'author', 'thumbnail' ),
'register_meta_box_cb' => 'sportspress_directory_meta_init',
'rewrite' => array( 'slug' => get_option( 'sp_directory_slug', 'list' ) ),
'show_in_menu' => 'edit.php?post_type=sp_player',
'show_in_admin_bar' => true,
'capability_type' => 'sp_directory'
);
register_post_type( 'sp_directory', $args );
}
add_action( 'init', 'sportspress_directory_post_init' );
function sportspress_directory_edit_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Title', 'sportspress' ),
'sp_staff' => __( 'Staff', 'sportspress' ),
'sp_league' => __( 'League', 'sportspress' ),
'sp_season' => __( 'Season', 'sportspress' ),
'sp_team' => __( 'Team', 'sportspress' ),
'sp_views' => __( 'Views', 'sportspress' ),
);
return $columns;
}
add_filter( 'manage_edit-sp_directory_columns', 'sportspress_directory_edit_columns' );
function sportspress_directory_meta_init( $post ) {
$players = (array)get_post_meta( $post->ID, 'sp_staff', false );
remove_meta_box( 'sp_seasondiv', 'sp_directory', 'side' );
remove_meta_box( 'sp_leaguediv', 'sp_directory', 'side' );
add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'sportspress_directory_format_meta', 'sp_directory', 'side', 'high' );
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_directory_details_meta', 'sp_directory', 'side', 'high' );
//add_meta_box( 'sp_columnsdiv', __( 'Staff List', 'sportspress' ), 'sportspress_directory_columns_meta', 'sp_directory', 'normal', 'high' );
add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'sportspress_directory_description_meta', 'sp_directory', 'normal', 'high' );
}
function sportspress_directory_format_meta( $post ) {
global $sportspress_formats;
$the_format = get_post_meta( $post->ID, 'sp_format', true );
?>
<div id="post-formats-select">
<?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
}
function sportspress_directory_details_meta( $post ) {
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 );
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
$team_id = get_post_meta( $post->ID, 'sp_team', true );
$orderby = get_post_meta( $post->ID, 'sp_orderby', true );
$order = get_post_meta( $post->ID, 'sp_order', true );
?>
<div>
<p><strong><?php _e( 'League', 'sportspress' ); ?></strong></p>
<p>
<?php
$args = array(
'taxonomy' => 'sp_league',
'name' => 'sp_league',
'selected' => $league_id,
'values' => 'term_id',
);
if ( ! sportspress_dropdown_taxonomies( $args ) ):
sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
endif;
?>
</p>
<p><strong><?php _e( 'Season', 'sportspress' ); ?></strong></p>
<p class="sp-tab-select">
<?php
$args = array(
'taxonomy' => 'sp_season',
'name' => 'sp_season',
'selected' => $season_id,
'values' => 'term_id',
);
if ( ! sportspress_dropdown_taxonomies( $args ) ):
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
endif;
?>
</p>
<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 ( ! sportspress_dropdown_pages( $args ) ):
sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
endif;
?>
</p>
<p><strong><?php _e( 'Sort by:', 'sportspress' ); ?></strong></p>
<p>
<?php
$args = array(
'prepend_options' => array(
'number' => __( 'Number', 'sportspress' ),
'name' => __( 'Name', 'sportspress' ),
'eventsplayed' => __( 'Played', 'sportspress' )
),
'post_type' => 'sp_statistic',
'name' => 'sp_orderby',
'selected' => $orderby,
'values' => 'slug',
);
if ( ! sportspress_dropdown_pages( $args ) ):
sportspress_post_adder( 'sp_directory', __( 'Add New', 'sportspress' ) );
endif;
?>
</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( 'Staff', 'sportspress' ); ?></strong></p>
<?php
sportspress_post_checklist( $post->ID, 'sp_staff', 'block', 'sp_team' );
sportspress_post_adder( 'sp_staff', __( 'Add New', 'sportspress' ) );
?>
</div>
<?php
sportspress_nonce();
}
function sportspress_directory_columns_meta( $post ) {
list( $columns, $usecolumns, $data, $placeholders, $merged ) = sportspress_get_player_list_data( $post->ID, true );
sportspress_edit_player_list_table( $columns, $usecolumns, $data, $placeholders );
sportspress_nonce();
}
function sportspress_directory_description_meta( $post ) {
wp_editor( $post->post_content, 'content' );
}

View File

@@ -4,7 +4,7 @@ Tags: sports, sports journalism, teams, team management, fixtures, results, stan
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
Requires at least: 3.8 Requires at least: 3.8
Tested up to: 3.8.1 Tested up to: 3.8.1
Stable tag: 0.4.3 Stable tag: 0.5
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -12,7 +12,7 @@ SportsPress is a fully configurable sports plugin that seamlessly automates leag
== Description == == Description ==
Add schedules, results, league tables, player profiles and statistics to your team or league site with SportsPress. It is designed to work with virtually every WordPress theme, and includes several language translations. Add schedules, results, league tables, player profiles and statistics to your team or league site with SportsPress. It uses core WordPress markup syntax and is designed to work with virtually every theme. Several language translations are included.
= Features = = Features =
* Team Profiles * Team Profiles
@@ -25,6 +25,7 @@ Add schedules, results, league tables, player profiles and statistics to your te
* Season Archives * Season Archives
* Venue Information & Maps * Venue Information & Maps
* Statistics & League Table Columns Configuration * Statistics & League Table Columns Configuration
* Import Events, Teams, and Players from CSV Files
= Customizable = = Customizable =
@@ -151,6 +152,25 @@ SportsPress is currently in beta and is undergoing testing. We are still activel
== Changelog == == Changelog ==
= 0.5 =
* Feature - Import tool added for importing events from CSV file.
* Feature - New post type Calendar added.
* Feature - League and Friendly format options added to events.
* Feature - List and Gallery format options added to player lists.
* Feature - Calendar and List format options added to calendars.
* Feature - Options added to turn on and off player list columns.
* Feature - Options added to player list widget to limit rows and display link to view all players.
* Feature - Options added to calendar widget to filter events.
* Feature - New widget Events List added.
* Feature - New widget Player Gallery added.
* Refactor - Use singular slugs for secondary post types.
* Tweak - Add tooltips to icons in admin table headings.
* Tweak - Style event results in admin events list.
* Tweak - Separate event date and time in admin events list.
* Fix - Enable custom post type sorting in admin.
* Fix - Added check before displaying deleted posts in league tables and player lists.
* Fix - Adjust Select All filter in player lists and league tables.
= 0.4.3 = = 0.4.3 =
* Feature - Enable selecting multiple outcomes per team per event. * Feature - Enable selecting multiple outcomes per team per event.
* Tweak - Use icons in dashboard column labels for teams and roster. * Tweak - Use icons in dashboard column labels for teams and roster.

View File

@@ -6,7 +6,7 @@
Plugin Name: SportsPress Plugin Name: SportsPress
Plugin URI: http://themeboy.com/sportspress Plugin URI: http://themeboy.com/sportspress
Description: Manage your club and its players, staff, events, league tables, and player lists. Description: Manage your club and its players, staff, events, league tables, and player lists.
Version: 0.4.3 Version: 0.5
Author: ThemeBoy Author: ThemeBoy
Author URI: http://themeboy.com/ Author URI: http://themeboy.com/
License: GPLv3 License: GPLv3
@@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ):
exit; exit;
endif; endif;
define( 'SPORTSPRESS_VERSION', '0.4.3' ); define( 'SPORTSPRESS_VERSION', '0.5' );
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
@@ -75,6 +75,7 @@ require_once dirname( __FILE__ ) . '/admin/post-types/table.php';
require_once dirname( __FILE__ ) . '/admin/post-types/player.php'; require_once dirname( __FILE__ ) . '/admin/post-types/player.php';
require_once dirname( __FILE__ ) . '/admin/post-types/list.php'; require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php'; require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
//require_once dirname( __FILE__ ) . '/admin/post-types/directory.php';
// Terms // Terms
require_once dirname( __FILE__ ) . '/admin/terms/league.php'; require_once dirname( __FILE__ ) . '/admin/terms/league.php';
@@ -112,8 +113,7 @@ require_once dirname( __FILE__ ) . '/admin/hooks/current-screen.php';
require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php'; require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php';
require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php'; require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php';
require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php'; require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php'; require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php';;
//require_once dirname( __FILE__ ) . '/admin/hooks/media-buttons.php';
require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php'; require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php';
// Filters // Filters