diff --git a/assets/js/admin/editor-lang.php b/assets/js/admin/editor-lang.php index d46119de..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' + 'details', 'results', 'performance', 'venue', 'officials', 'teams', 'full', ), 'team' => array(), 'player' => array( @@ -30,6 +30,10 @@ $raw = apply_filters( 'sportspress_tinymce_strings', array( 'results' => __( 'Results', 'sportspress' ), 'countdown' => __( 'Countdown', 'sportspress' ), 'performance' => __( 'Box Score', 'sportspress' ), + '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 f649422e..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 @@ -23,6 +23,10 @@ class SP_Meta_Box_Event_Shortcode { 'event_results' => __( 'Results', 'sportspress' ), 'event_details' => __( 'Details', 'sportspress' ), 'event_performance' => __( 'Box Score', 'sportspress' ), + '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 7fb27639..36a17dd5 100644 --- a/includes/class-sp-ajax.php +++ b/includes/class-sp-ajax.php @@ -27,6 +27,9 @@ class SP_AJAX { 'event_details_shortcode' => false, 'event_results_shortcode' => false, 'event_performance_shortcode' => false, + 'event_venue_shortcode' => false, + 'event_officials_shortcode' => false, + 'event_teams_shortcode' => false, 'event_calendar_shortcode' => false, 'event_list_shortcode' => false, 'event_blocks_shortcode' => false, @@ -181,6 +184,126 @@ class SP_AJAX { self::scripts(); die(); } + + /** + * AJAX event_venue shortcode + */ + public function event_venue_shortcode() { + ?> +
+

+ +

+ +

+ + +

+
+ +
+

+ +

+ +

+ + +

+
+ +
+

+ +

+ +

+ + +

+
+ +
+

+ +

+ +

+ + +

+
+ __CLASS__ . '::event_results', 'event_details' => __CLASS__ . '::event_details', 'event_performance' => __CLASS__ . '::event_performance', + 'event_venue' => __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', @@ -101,6 +105,50 @@ class SP_Shortcodes { public static function event_performance( $atts ) { return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Performance', 'output' ), $atts ); } + + /** + * Event venue shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function event_venue( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Venue', 'output' ), $atts ); + } + + /** + * Event officials shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + public static function event_officials( $atts ) { + return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Officials', 'output' ), $atts ); + } + + /** + * Event teams shortcode. + * + * @access public + * @param mixed $atts + * @return string + */ + 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 '
'; + if ( 'content' === $key ) { + echo $content; + // Template content hook + do_action( 'sportspress_single_' . $type . '_content' ); + } elseif ( 'excerpt' === $key ) { + sp_get_template( 'post-excerpt.php', $atts ); + } else { + //call_user_func( $template['action'] ); + sp_get_template( 'event-' . $key . '.php', $atts ); + } + echo '
'; + } + } + + // After template hook + do_action( 'sportspress_after_single_' . $type ); + + $ob = ob_get_clean(); + + $tabs = ''; + + if ( ! empty( $tab_templates ) ) { + $i = 0; + $tab_content = ''; + + foreach ( $tab_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; + + // Put tab content into buffer + ob_start(); + if ( 'content' === $key ) { + echo $content; + // Template content hook + do_action( 'sportspress_single_' . $type . '_content' ); + } elseif ( 'excerpt' === $key ) { + sp_get_template( 'post-excerpt.php', $atts ); + } else { + //call_user_func( $template['action'] ); + sp_get_template( 'event-' . $key . '.php', $atts ); + } + $buffer = ob_get_clean(); + + // Trim whitespace from buffer + $buffer = trim( $buffer ); + + // Continue if tab content is empty + if ( empty( $buffer ) ) continue; + + // Get template label + $label = sp_array_value( $template, 'label', $template['title'] ); + + // Add to tabs + $tabs .= '
  • ' . apply_filters( 'gettext', $label, $label, 'sportspress' ) . '
  • '; + + // Render the template + $tab_content .= '
    ' . $buffer . '
    '; + + $i++; + } + + $ob .= '
    '; + + if ( ! empty( $tabs ) ) { + $ob .= ''; + } + + $ob .= $tab_content; + + $ob .= '
    '; + } + + echo $ob; + + } +} diff --git a/includes/shortcodes/class-sp-shortcode-event-officials.php b/includes/shortcodes/class-sp-shortcode-event-officials.php new file mode 100644 index 00000000..da6b4d24 --- /dev/null +++ b/includes/shortcodes/class-sp-shortcode-event-officials.php @@ -0,0 +1,24 @@ +post_excerpt; if ( $excerpt ) {