diff --git a/assets/js/admin/editor-lang.php b/assets/js/admin/editor-lang.php index ee8c313f..0e0e00ca 100644 --- a/assets/js/admin/editor-lang.php +++ b/assets/js/admin/editor-lang.php @@ -4,7 +4,7 @@ $shortcodes = ''; $options = array( 'event' => array( - 'details', 'results', 'performance', 'venue', 'officials', 'teams', + 'details', 'results', 'performance', 'venue', 'officials', 'teams', 'full', ), 'team' => array(), 'player' => array( @@ -33,6 +33,7 @@ $raw = apply_filters( 'sportspress_tinymce_strings', array( 'venue' => __( 'Venue', 'sportspress' ), 'officials' => __( 'Officials', 'sportspress' ), 'teams' => __( 'Teams', 'sportspress' ), + 'full' => __( 'Full Info', 'sportspress' ), 'calendar' => __( 'Calendar', 'sportspress' ), 'statistics' => __( 'Statistics', 'sportspress' ), 'team' => __( 'Team', 'sportspress' ), 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 787dc1b3..a1945b88 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 @@ -26,6 +26,7 @@ class SP_Meta_Box_Event_Shortcode { 'event_venue' => __( 'Venue', 'sportspress' ), 'event_officials' => __( 'Officials', 'sportspress' ), 'event_teams' => __( 'Teams', 'sportspress' ), + 'event_full' => __( 'Full Info', 'sportspress' ), ) ); if ( $shortcodes ) { ?> diff --git a/includes/class-sp-ajax.php b/includes/class-sp-ajax.php index 985d351a..36a17dd5 100644 --- a/includes/class-sp-ajax.php +++ b/includes/class-sp-ajax.php @@ -274,6 +274,36 @@ class SP_AJAX { self::scripts(); die(); } + + /** + * AJAX event_full shortcode + */ + public function event_full_shortcode() { + ?> +
+ __CLASS__ . '::event_venue', 'event_officials' => __CLASS__ . '::event_officials', 'event_teams' => __CLASS__ . '::event_teams', + 'event_full' => __CLASS__ . '::event_full', 'countdown' => __CLASS__ . '::countdown', 'player_details' => __CLASS__ . '::player_details', 'player_statistics' => __CLASS__ . '::player_statistics', @@ -137,6 +138,17 @@ class SP_Shortcodes { public static function event_teams( $atts ) { return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Teams', 'output' ), $atts ); } + + /** + * Event full info shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function event_full( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Full', 'output' ), $atts ); + } /** * Countdown shortcode. diff --git a/includes/shortcodes/class-sp-shortcode-event-full.php b/includes/shortcodes/class-sp-shortcode-event-full.php new file mode 100644 index 00000000..7b69db03 --- /dev/null +++ b/includes/shortcodes/class-sp-shortcode-event-full.php @@ -0,0 +1,139 @@ +templates->$type; + + // Combine layout setting with available templates + $templates = array_merge( array_flip( $layout ), $templates ); + + $templates = apply_filters( 'sportspress_' . $type . '_templates', $templates ); + + // Split templates into sections and tabs + $slice = array_search( 'tabs', array_keys( $templates ) ); + if ( $slice ) { + $section_templates = array_slice( $templates, 0, $slice ); + $tab_templates = array_slice( $templates, $slice ); + } else { + $section_templates = $templates; + $tab_templates = array(); + } + + ob_start(); + + // Before template hook + do_action( 'sportspress_before_single_' . $type ); + + // Loop through sections + if ( ! empty( $section_templates ) ) { + foreach ( $section_templates as $key => $template ) { + // Ignore templates that are unavailable or that have been turned off + if ( ! is_array( $template ) ) continue; + if ( ! isset( $template['option'] ) ) continue; + if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) continue; + + // Render the template + echo '