From 16429008a9afe3cbd15e5a0efc56ead937c6d6f5 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 18 Apr 2014 22:33:30 +1000 Subject: [PATCH] Display 3 different shortcodes for event sections --- .../class-sp-meta-box-event-shortcode.php | 13 +++- includes/class-sp-post-types.php | 8 +-- includes/class-sp-shortcodes.php | 60 +++++++++++++------ ...p => class-sp-shortcode-event-details.php} | 12 ++-- .../class-sp-shortcode-event-performance.php | 24 ++++++++ .../class-sp-shortcode-event-results.php | 24 ++++++++ 6 files changed, 111 insertions(+), 30 deletions(-) rename includes/shortcodes/{class-sp-shortcode-event.php => class-sp-shortcode-event-details.php} (53%) create mode 100644 includes/shortcodes/class-sp-shortcode-event-performance.php create mode 100644 includes/shortcodes/class-sp-shortcode-event-results.php diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php index 034246a5..bb47e1f0 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php @@ -23,7 +23,18 @@ class SP_Meta_Box_Event_Shortcode {

-

+

+ +

+

+

+ +

+

+

+ +

+

true, 'rewrite' => array( 'slug' => get_option( 'sportspress_venue_slug', 'venue' ) ), ); - $object_types = array( 'sp_event', 'sp_calendar', 'attachment' ); + $object_types = array( 'sp_event', 'sp_calendar' ); register_taxonomy( 'sp_venue', $object_types, $args ); foreach ( $object_types as $object_type ): register_taxonomy_for_object_type( 'sp_league', $object_type ); @@ -141,7 +141,7 @@ class SP_Post_types { 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_position_slug', 'position' ) ), ); - $object_types = array( 'sp_player', 'sp_performance', 'sp_metric', 'attachment' ); + $object_types = array( 'sp_player', 'sp_performance', 'sp_metric' ); register_taxonomy( 'sp_position', $object_types, $args ); foreach ( $object_types as $object_type ): register_taxonomy_for_object_type( 'sp_league', $object_type ); @@ -417,7 +417,7 @@ class SP_Post_types { 'exclude_from_search' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_teams_slug', 'teams' ) ), - 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'supports' => array( 'title', 'author', 'thumbnail', 'page-attributes' ), 'has_archive' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-shield-alt', @@ -478,7 +478,7 @@ class SP_Post_types { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_players_slug', 'players' ) ), - 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes' ), + 'supports' => array( 'title', 'author', 'thumbnail', 'excerpt', 'page-attributes' ), 'has_archive' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-groups', diff --git a/includes/class-sp-shortcodes.php b/includes/class-sp-shortcodes.php index 7fea7465..793c5e9b 100644 --- a/includes/class-sp-shortcodes.php +++ b/includes/class-sp-shortcodes.php @@ -16,16 +16,16 @@ class SP_Shortcodes { public static function init() { // Define shortcodes $shortcodes = array( - 'event' => __CLASS__ . '::event', - 'countdown' => __CLASS__ . '::countdown', - 'event_list' => __CLASS__ . '::event_list', - 'event_calendar' => __CLASS__ . '::event_calendar', -// 'team' => __CLASS__ . '::team', - 'league_table' => __CLASS__ . '::league_table', -// 'player' => __CLASS__ . '::player', - 'player_list' => __CLASS__ . '::player_list', - 'player_gallery' => __CLASS__ . '::player_gallery', -// 'staff' => __CLASS__ . '::staff', + 'event_results' => __CLASS__ . '::event_results', + 'event_details' => __CLASS__ . '::event_details', + 'event_performance' => __CLASS__ . '::event_performance', + 'countdown' => __CLASS__ . '::countdown', + 'event_list' => __CLASS__ . '::event_list', + 'event_calendar' => __CLASS__ . '::event_calendar', + 'league_table' => __CLASS__ . '::league_table', + 'player_metrics' => __CLASS__ . '::player_metrics', + 'player_list' => __CLASS__ . '::player_list', + 'player_gallery' => __CLASS__ . '::player_gallery', ); foreach ( $shortcodes as $shortcode => $function ) { @@ -62,14 +62,36 @@ class SP_Shortcodes { } /** - * Event shortcode. + * Event results shortcode. * * @access public * @param mixed $atts * @return string */ - public static function event( $atts ) { - return self::shortcode_wrapper( array( 'SP_Shortcode_Event', 'output' ), $atts ); + public static function event_results( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Results', 'output' ), $atts ); + } + + /** + * Event details shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function event_details( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Details', 'output' ), $atts ); + } + + /** + * Event performance shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function event_performance( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Performance', 'output' ), $atts ); } /** @@ -106,14 +128,14 @@ class SP_Shortcodes { } /** - * Team shortcode. + * Team columns shortcode. * * @access public * @param mixed $atts * @return string */ - public static function team( $atts ) { - return self::shortcode_wrapper( array( 'SP_Shortcode_Team', 'output' ), $atts ); + public static function team_columns( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Team_Columns', 'output' ), $atts ); } /** @@ -128,14 +150,14 @@ class SP_Shortcodes { } /** - * Player shortcode. + * Player performance shortcode. * * @access public * @param mixed $atts * @return string */ - public static function player( $atts ) { - return self::shortcode_wrapper( array( 'SP_Shortcode_Player', 'output' ), $atts ); + public static function player_performance( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Player_Performance', 'output' ), $atts ); } /** diff --git a/includes/shortcodes/class-sp-shortcode-event.php b/includes/shortcodes/class-sp-shortcode-event-details.php similarity index 53% rename from includes/shortcodes/class-sp-shortcode-event.php rename to includes/shortcodes/class-sp-shortcode-event-details.php index 99a65d96..66ae1849 100644 --- a/includes/shortcodes/class-sp-shortcode-event.php +++ b/includes/shortcodes/class-sp-shortcode-event-details.php @@ -1,16 +1,16 @@