From 1aa1cb56ec6e755b0007d8a0b01f97c276a1401a Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 18 Mar 2014 01:03:06 +1100 Subject: [PATCH] Initialize directory post type and tag 0.5 --- admin/hooks/admin-head.php | 2 + admin/hooks/admin-init.php | 1 + admin/hooks/media-buttons.php | 11 --- admin/post-types/directory.php | 165 +++++++++++++++++++++++++++++++++ readme.txt | 24 ++++- sportspress.php | 8 +- 6 files changed, 194 insertions(+), 17 deletions(-) delete mode 100644 admin/hooks/media-buttons.php create mode 100644 admin/post-types/directory.php diff --git a/admin/hooks/admin-head.php b/admin/hooks/admin-head.php index 3bcb7d5e..edc49bdd 100644 --- a/admin/hooks/admin-head.php +++ b/admin/hooks/admin-head.php @@ -9,6 +9,8 @@ function sportspress_admin_head() { sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' ); elseif ( $typenow == '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-post.php', 'sportspress_admin_head', 10, 2 ); diff --git a/admin/hooks/admin-init.php b/admin/hooks/admin-init.php index 1b0b3ec6..55a94637 100644 --- a/admin/hooks/admin-init.php +++ b/admin/hooks/admin-init.php @@ -7,6 +7,7 @@ function sportspress_admin_init() { 'sp_player', 'sp_list', 'sp_staff', + 'sp_directory', 'sp_config', ); diff --git a/admin/hooks/media-buttons.php b/admin/hooks/media-buttons.php deleted file mode 100644 index ab9cc668..00000000 --- a/admin/hooks/media-buttons.php +++ /dev/null @@ -1,11 +0,0 @@ - - - - __( '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' => '', + '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 ); + ?> +
+ $format ): ?> + >
+ +
+ 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 ); + ?> +
+

+

+ '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; + ?> +

+

+

+ '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; + ?> +

+

+

+ '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; + ?> +

+

+

+ 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; + ?> +

+

+

+ +

+

+ ID, 'sp_staff', 'block', 'sp_team' ); + sportspress_post_adder( 'sp_staff', __( 'Add New', 'sportspress' ) ); + ?> +
+ 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' ); +} diff --git a/readme.txt b/readme.txt index 66edd8e9..4601bfdb 100644 --- a/readme.txt +++ b/readme.txt @@ -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 Requires at least: 3.8 Tested up to: 3.8.1 -Stable tag: 0.4.3 +Stable tag: 0.5 License: GPLv3 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 == -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 = * Team Profiles @@ -25,6 +25,7 @@ Add schedules, results, league tables, player profiles and statistics to your te * Season Archives * Venue Information & Maps * Statistics & League Table Columns Configuration +* Import Events, Teams, and Players from CSV Files = Customizable = @@ -151,6 +152,25 @@ SportsPress is currently in beta and is undergoing testing. We are still activel == 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 = * Feature - Enable selecting multiple outcomes per team per event. * Tweak - Use icons in dashboard column labels for teams and roster. diff --git a/sportspress.php b/sportspress.php index 01c0c88b..19be45e9 100644 --- a/sportspress.php +++ b/sportspress.php @@ -6,7 +6,7 @@ Plugin Name: SportsPress Plugin URI: http://themeboy.com/sportspress Description: Manage your club and its players, staff, events, league tables, and player lists. -Version: 0.4.3 +Version: 0.5 Author: ThemeBoy Author URI: http://themeboy.com/ License: GPLv3 @@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ): exit; endif; -define( 'SPORTSPRESS_VERSION', '0.4.3' ); +define( 'SPORTSPRESS_VERSION', '0.5' ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __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/list.php'; require_once dirname( __FILE__ ) . '/admin/post-types/staff.php'; +//require_once dirname( __FILE__ ) . '/admin/post-types/directory.php'; // Terms 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/post-thumbnail-html.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/media-buttons.php'; +require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php';; require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php'; // Filters