Add events to team pages

This commit is contained in:
Brian Miyaji
2016-04-08 15:26:59 +10:00
parent 36bc9bc622
commit 35ed9962d4
12 changed files with 227 additions and 38 deletions

View File

@@ -37,7 +37,9 @@ class SportsPress_Calendars {
// Filters
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
add_filter( 'sportspress_event_settings', array( $this, 'add_settings' ) );
add_filter( 'sportspress_event_settings', array( $this, 'add_event_settings' ) );
add_filter( 'sportspress_team_options', array( $this, 'add_team_options' ) );
add_filter( 'sportspress_after_team_template', array( $this, 'add_team_template' ), 40 );
}
/**
@@ -180,11 +182,11 @@ class SportsPress_Calendars {
}
/**
* Add settings.
* Add event settings.
*
* @return array
*/
public function add_settings( $settings ) {
public function add_event_settings( $settings ) {
$settings = array_merge( $settings,
array(
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
@@ -305,7 +307,7 @@ class SportsPress_Calendars {
'title' => __( 'Limit', 'sportspress' ),
'id' => 'sportspress_event_blocks_rows',
'class' => 'small-text',
'default' => '10',
'default' => '5',
'desc' => __( 'events', 'sportspress' ),
'type' => 'number',
'custom_attributes' => array(
@@ -321,6 +323,44 @@ class SportsPress_Calendars {
);
return $settings;
}
/**
* Add team options.
*
* @return array
*/
public function add_team_options( $options ) {
return array_merge( $options,
array(
array(
'title' => __( 'Events', 'sportspress' ),
'id' => 'sportspress_team_events_format',
'default' => 'title',
'type' => 'select',
'options' => array(
'blocks' => __( 'Blocks', 'sportspress' ),
'calendar' => __( 'Calendar', 'sportspress' ),
),
),
)
);
}
/**
* Add team template.
*
* @return array
*/
public function add_team_template( $templates ) {
return array_merge( $templates, array(
'events' => array(
'title' => __( 'Events', 'sportspress' ),
'option' => 'sportspress_team_show_events',
'action' => 'sportspress_output_team_events',
'default' => 'no',
),
) );
}
}
endif;