diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php index 1313ca5f..bfa448ac 100644 --- a/includes/admin/post-types/class-sp-admin-meta-boxes.php +++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php @@ -93,6 +93,7 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Performance_Details::output', 'sp_performance', 'normal', 'high' ); // Events + add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_Event_Shortcode::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' ); @@ -109,6 +110,7 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_Calendar_Description::output', 'sp_calendar', 'normal', 'high' ); // Teams +// add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_Team_Shortcode::output', 'sp_team', 'side', 'default' ); add_meta_box( 'sp_columnssdiv', __( 'Columns', 'sportspress' ), 'SP_Meta_Box_Team_Columns::output', 'sp_team', 'normal', 'high' ); // Tables @@ -118,6 +120,7 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_Table_Description::output', 'sp_table', 'normal', 'high' ); // Players +// add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_Player_Shortcode::output', 'sp_player', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Player_Details::output', 'sp_player', 'side', 'default' ); add_meta_box( 'sp_metricsdiv', __( 'Metrics', 'sportspress' ), 'SP_Meta_Box_Player_Metrics::output', 'sp_player', 'side', 'default' ); add_meta_box( 'sp_performancediv', __( 'Performance', 'sportspress' ), 'SP_Meta_Box_Player_Performance::output', 'sp_player', 'normal', 'high' ); @@ -128,6 +131,9 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_List_Details::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_datadiv', __( 'Player List', 'sportspress' ), 'SP_Meta_Box_List_Data::output', 'sp_list', 'normal', 'high' ); add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_List_Description::output', 'sp_list', 'normal', 'high' ); + + // Staff +// add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_Staff_Shortcode::output', 'sp_staff', 'side', 'default' ); } /** 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 new file mode 100644 index 00000000..034246a5 --- /dev/null +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php @@ -0,0 +1,29 @@ + +

+ +

+

+ +

+ +

+

+ +

+ +

+

+ +

+ +

+

+ __CLASS__ . '::countdown', - 'event_list' => __CLASS__ . '::event_list', - 'event_calendar' => __CLASS__ . '::event_calendar', - 'league_table' => __CLASS__ . '::league_table', - 'player_list' => __CLASS__ . '::player_list', - 'player_gallery' => __CLASS__ . '::player_gallery', + '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', ); foreach ( $shortcodes as $shortcode => $function ) { @@ -57,6 +61,17 @@ class SP_Shortcodes { return ob_get_clean(); } + /** + * Event shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function event( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event', 'output' ), $atts ); + } + /** * Countdown shortcode. * @@ -90,6 +105,17 @@ class SP_Shortcodes { return self::shortcode_wrapper( array( 'SP_Shortcode_Event_List', 'output' ), $atts ); } + /** + * Team shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function team( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Team', 'output' ), $atts ); + } + /** * League table shortcode. * @@ -101,6 +127,17 @@ class SP_Shortcodes { return self::shortcode_wrapper( array( 'SP_Shortcode_League_Table', 'output' ), $atts ); } + /** + * Player shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function player( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Player', 'output' ), $atts ); + } + /** * Player list shortcode. * @@ -122,4 +159,15 @@ class SP_Shortcodes { public static function player_gallery( $atts ) { return self::shortcode_wrapper( array( 'SP_Shortcode_Player_Gallery', 'output' ), $atts ); } + + /** + * Staff shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function staff( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Staff', 'output' ), $atts ); + } } diff --git a/includes/shortcodes/class-sp-shortcode-event.php b/includes/shortcodes/class-sp-shortcode-event.php new file mode 100644 index 00000000..99a65d96 --- /dev/null +++ b/includes/shortcodes/class-sp-shortcode-event.php @@ -0,0 +1,24 @@ +autoembed( $video_url ); - endif; - - // Results - sp_get_template( 'event-results.php' ); - - // Details - sp_get_template( 'event-details.php' ); - - // Venue - sp_get_template( 'event-venue.php' ); - - // Performance - sp_get_template( 'event-performance.php' ); - - // Staff - sp_get_template( 'event-staff.php' ); - endif; + if ( is_singular( 'sp_event' ) && in_the_loop() ) + sp_get_template( 'event.php' ); return $content; } @@ -258,9 +235,8 @@ function sportspress_default_table_content( $content ) { add_filter( 'the_content', 'sportspress_default_table_content' ); function sportspress_default_player_content( $content ) { - if ( is_singular( 'sp_player' ) && in_the_loop() ): + if ( is_singular( 'sp_player' ) && in_the_loop() ) sp_get_template( 'player.php' ); - endif; return $content; } add_filter( 'the_content', 'sportspress_default_player_content' ); diff --git a/templates/event-video.php b/templates/event-video.php new file mode 100644 index 00000000..1efda659 --- /dev/null +++ b/templates/event-video.php @@ -0,0 +1,9 @@ +autoembed( $video_url ); +endif; diff --git a/templates/event.php b/templates/event.php new file mode 100644 index 00000000..da0267af --- /dev/null +++ b/templates/event.php @@ -0,0 +1,9 @@ + $id ) ); +sp_get_template( 'event-results.php', array( 'id' => $id ) ); +sp_get_template( 'event-details.php', array( 'id' => $id ) ); +sp_get_template( 'event-venue.php', array( 'id' => $id ) ); +sp_get_template( 'event-performance.php', array( 'id' => $id ) );