diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index 0ec66c6d..34782217 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -448,6 +448,10 @@ clear: both; } +span.sp_event_spec_label { + font-weight: bold; +} + /* Event Logos Block */ .sp-template-event-logos-block .team-logo { float: none; diff --git a/modules/sportspress-event-specs.php b/modules/sportspress-event-specs.php index 69277bac..e973dc37 100644 --- a/modules/sportspress-event-specs.php +++ b/modules/sportspress-event-specs.php @@ -34,6 +34,7 @@ class SportsPress_Event_Specs { add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) ); add_action( 'sportspress_event_list_head_row', array( $this, 'event_list_head_row' ), 11 ); add_action( 'sportspress_event_list_row', array( $this, 'event_list_row' ), 11, 2 ); + add_action( 'sportspress_event_blocks_after', array( $this, 'event_blocks_after' ), 11, 2 ); // Filters add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) ); @@ -230,7 +231,7 @@ class SportsPress_Event_Specs { * Event list head row. */ public function event_list_head_row( $usecolumns = array() ) { - if ( is_array( $usecolumns ) && in_array( 'event_specs', $usecolumns ) ) { + if ( sp_column_active( $usecolumns, 'event_specs' ) ) { $spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false ); if ( empty( $spec_labels ) ) return; @@ -249,7 +250,7 @@ class SportsPress_Event_Specs { * Event list row. */ public function event_list_row( $event, $usecolumns = array() ) { - if ( is_array( $usecolumns ) && in_array( 'event_specs', $usecolumns ) ) { + if ( sp_column_active( $usecolumns, 'event_specs' ) ) { $event = new SP_Event( $event ); $specs = $event->specs( false ); $spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false ); @@ -267,6 +268,20 @@ class SportsPress_Event_Specs { } } } + + /** + * Add Event Specs after default template of Event blocks is loaded. + */ + public function event_blocks_after( $event, $usecolumns = array() ) { + if ( sp_column_active( $usecolumns, 'event_specs' ) ) { + $event = new SP_Event( $event ); + $specs = $event->specs( false ); + $spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false ); + foreach ( $specs as $spec_label => $spec_value ) { + echo '
'.$spec_label.': '.$spec_value.'
'; + } + } + } } endif; diff --git a/templates/event-blocks.php b/templates/event-blocks.php index 8c83aa6b..b00870eb 100644 --- a/templates/event-blocks.php +++ b/templates/event-blocks.php @@ -37,6 +37,7 @@ $defaults = array( 'rows' => get_option( 'sportspress_event_blocks_rows', 5 ), 'orderby' => 'default', 'order' => 'default', + 'columns' => null, 'show_all_events_link' => false, 'show_title' => get_option( 'sportspress_event_blocks_show_title', 'no' ) == 'yes' ? true : false, 'show_league' => get_option( 'sportspress_event_blocks_show_league', 'no' ) == 'yes' ? true : false, @@ -49,9 +50,10 @@ $defaults = array( extract( $defaults, EXTR_SKIP ); $calendar = new SP_Calendar( $id ); + if ( $status != 'default' ) $calendar->status = $status; -if ( $format != 'all' ) +if ( $format != 'default' ) $calendar->event_format = $format; if ( $date != 'default' ) $calendar->date = $date; @@ -88,6 +90,14 @@ if ( $orderby != 'default' ) if ( $day != 'default' ) $calendar->day = $day; $data = $calendar->data(); +$usecolumns = $calendar->columns; + +if ( isset( $columns ) ): + if ( is_array( $columns ) ) + $usecolumns = $columns; + else + $usecolumns = explode( ',', $columns ); +endif; if ( $hide_if_empty && empty( $data ) ) return false; @@ -161,6 +171,7 @@ if ( $title ) ?> +