Responsive tables and individual content filters
This commit is contained in:
@@ -18,20 +18,28 @@ function sportspress_admin_menu( $position ) {
|
||||
endif;
|
||||
|
||||
// Remove "Venues" and "Positions" links from Media submenu
|
||||
if ( isset( $submenu['upload.php'] ) ):
|
||||
$submenu['upload.php'] = array_filter( $submenu['upload.php'], 'sportspress_admin_menu_remove_venues' );
|
||||
$submenu['upload.php'] = array_filter( $submenu['upload.php'], 'sportspress_admin_menu_remove_positions' );
|
||||
endif;
|
||||
|
||||
// Remove "Leagues" and "Seasons" links from Events submenu
|
||||
if ( isset( $submenu['edit.php?post_type=sp_event'] ) ):
|
||||
$submenu['edit.php?post_type=sp_event'] = array_filter( $submenu['edit.php?post_type=sp_event'], 'sportspress_admin_menu_remove_leagues' );
|
||||
$submenu['edit.php?post_type=sp_event'] = array_filter( $submenu['edit.php?post_type=sp_event'], 'sportspress_admin_menu_remove_seasons' );
|
||||
endif;
|
||||
|
||||
// Remove "Leagues" and "Seasons" links from Players submenu
|
||||
if ( isset( $submenu['edit.php?post_type=sp_player'] ) ):
|
||||
$submenu['edit.php?post_type=sp_player'] = array_filter( $submenu['edit.php?post_type=sp_player'], 'sportspress_admin_menu_remove_leagues' );
|
||||
$submenu['edit.php?post_type=sp_player'] = array_filter( $submenu['edit.php?post_type=sp_player'], 'sportspress_admin_menu_remove_seasons' );
|
||||
endif;
|
||||
|
||||
// Remove "Leagues" and "Seasons" links from Staff submenu
|
||||
if ( isset( $submenu['edit.php?post_type=sp_staff'] ) ):
|
||||
$submenu['edit.php?post_type=sp_staff'] = array_filter( $submenu['edit.php?post_type=sp_staff'], 'sportspress_admin_menu_remove_leagues' );
|
||||
$submenu['edit.php?post_type=sp_staff'] = array_filter( $submenu['edit.php?post_type=sp_staff'], 'sportspress_admin_menu_remove_seasons' );
|
||||
endif;
|
||||
|
||||
}
|
||||
add_action( 'admin_menu', 'sportspress_admin_menu' );
|
||||
|
||||
@@ -1,119 +1,111 @@
|
||||
<?php
|
||||
function sportspress_activation_hook() {
|
||||
|
||||
$admin_capabilites = array(
|
||||
'read_sp_events',
|
||||
'read_private_sp_events',
|
||||
'edit_sp_event',
|
||||
'edit_sp_events',
|
||||
'edit_published_sp_events',
|
||||
'edit_private_sp_events',
|
||||
'edit_others_sp_events',
|
||||
'delete_sp_event',
|
||||
'delete_published_sp_events',
|
||||
'delete_private_sp_events',
|
||||
'delete_others_sp_events',
|
||||
'publish_sp_events',
|
||||
'read_sp_calendars',
|
||||
'read_private_sp_calendars',
|
||||
'edit_sp_calendar',
|
||||
'edit_sp_calendars',
|
||||
'edit_published_sp_calendars',
|
||||
'edit_private_sp_calendars',
|
||||
'edit_others_sp_calendars',
|
||||
'delete_sp_calendar',
|
||||
'delete_published_sp_calendars',
|
||||
'delete_private_sp_calendars',
|
||||
'delete_others_sp_calendars',
|
||||
'publish_sp_calendars',
|
||||
'read_sp_teams',
|
||||
'read_private_sp_teams',
|
||||
'edit_sp_team',
|
||||
'edit_sp_teams',
|
||||
'edit_published_sp_teams',
|
||||
'edit_private_sp_teams',
|
||||
'edit_others_sp_teams',
|
||||
'delete_sp_team',
|
||||
'delete_published_sp_teams',
|
||||
'delete_private_sp_teams',
|
||||
'delete_others_sp_teams',
|
||||
'publish_sp_teams',
|
||||
'read_sp_tables',
|
||||
'read_private_sp_tables',
|
||||
'edit_sp_table',
|
||||
'edit_sp_tables',
|
||||
'edit_published_sp_tables',
|
||||
'edit_private_sp_tables',
|
||||
'edit_others_sp_tables',
|
||||
'delete_sp_table',
|
||||
'delete_published_sp_tables',
|
||||
'delete_private_sp_tables',
|
||||
'delete_others_sp_tables',
|
||||
'publish_sp_tables',
|
||||
'read_sp_players',
|
||||
'read_private_sp_players',
|
||||
'edit_sp_player',
|
||||
'edit_sp_players',
|
||||
'edit_published_sp_players',
|
||||
'edit_private_sp_players',
|
||||
'edit_others_sp_players',
|
||||
'delete_sp_player',
|
||||
'delete_published_sp_players',
|
||||
'delete_private_sp_players',
|
||||
'delete_others_sp_players',
|
||||
'publish_sp_players',
|
||||
'read_sp_lists',
|
||||
'read_private_sp_lists',
|
||||
'edit_sp_list',
|
||||
'edit_sp_lists',
|
||||
'edit_published_sp_lists',
|
||||
'edit_private_sp_lists',
|
||||
'edit_others_sp_lists',
|
||||
'delete_sp_list',
|
||||
'delete_published_sp_lists',
|
||||
'delete_private_sp_lists',
|
||||
'delete_others_sp_lists',
|
||||
'publish_sp_lists',
|
||||
'read_sp_staffs',
|
||||
'read_private_sp_staffs',
|
||||
'edit_sp_staff',
|
||||
'edit_sp_staffs',
|
||||
'edit_published_sp_staffs',
|
||||
'edit_private_sp_staffs',
|
||||
'edit_others_sp_staffs',
|
||||
'delete_sp_staff',
|
||||
'delete_published_sp_staffs',
|
||||
'delete_private_sp_staffs',
|
||||
'delete_others_sp_staffs',
|
||||
'publish_sp_staffs',
|
||||
'read_sp_configs',
|
||||
'read_private_sp_configs',
|
||||
'edit_sp_config',
|
||||
'edit_sp_configs',
|
||||
'edit_published_sp_configs',
|
||||
'edit_private_sp_configs',
|
||||
'edit_others_sp_configs',
|
||||
'delete_sp_config',
|
||||
'delete_published_sp_configs',
|
||||
'delete_private_sp_configs',
|
||||
'delete_others_sp_configs',
|
||||
'publish_sp_configs',
|
||||
);
|
||||
|
||||
// Site Admin
|
||||
$role = get_role( 'administrator' );
|
||||
|
||||
// Events
|
||||
$role->add_cap( 'read_sp_events' );
|
||||
$role->add_cap( 'read_private_sp_events' );
|
||||
$role->add_cap( 'edit_sp_event' );
|
||||
$role->add_cap( 'edit_sp_events' );
|
||||
$role->add_cap( 'edit_published_sp_events' );
|
||||
$role->add_cap( 'edit_private_sp_events' );
|
||||
$role->add_cap( 'edit_others_sp_events' );
|
||||
$role->add_cap( 'delete_sp_event' );
|
||||
$role->add_cap( 'delete_published_sp_events' );
|
||||
$role->add_cap( 'delete_private_sp_events' );
|
||||
$role->add_cap( 'delete_others_sp_events' );
|
||||
$role->add_cap( 'publish_sp_events' );
|
||||
|
||||
// Calendars
|
||||
$role->add_cap( 'read_sp_calendars' );
|
||||
$role->add_cap( 'read_private_sp_calendars' );
|
||||
$role->add_cap( 'edit_sp_calendar' );
|
||||
$role->add_cap( 'edit_sp_calendars' );
|
||||
$role->add_cap( 'edit_published_sp_calendars' );
|
||||
$role->add_cap( 'edit_private_sp_calendars' );
|
||||
$role->add_cap( 'edit_others_sp_calendars' );
|
||||
$role->add_cap( 'delete_sp_calendar' );
|
||||
$role->add_cap( 'delete_published_sp_calendars' );
|
||||
$role->add_cap( 'delete_private_sp_calendars' );
|
||||
$role->add_cap( 'delete_others_sp_calendars' );
|
||||
$role->add_cap( 'publish_sp_calendars' );
|
||||
|
||||
// Teams
|
||||
$role->add_cap( 'read_sp_teams' );
|
||||
$role->add_cap( 'read_private_sp_teams' );
|
||||
$role->add_cap( 'edit_sp_team' );
|
||||
$role->add_cap( 'edit_sp_teams' );
|
||||
$role->add_cap( 'edit_published_sp_teams' );
|
||||
$role->add_cap( 'edit_private_sp_teams' );
|
||||
$role->add_cap( 'edit_others_sp_teams' );
|
||||
$role->add_cap( 'delete_sp_team' );
|
||||
$role->add_cap( 'delete_published_sp_teams' );
|
||||
$role->add_cap( 'delete_private_sp_teams' );
|
||||
$role->add_cap( 'delete_others_sp_teams' );
|
||||
$role->add_cap( 'publish_sp_teams' );
|
||||
|
||||
// League Tables
|
||||
$role->add_cap( 'read_sp_tables' );
|
||||
$role->add_cap( 'read_private_sp_tables' );
|
||||
$role->add_cap( 'edit_sp_table' );
|
||||
$role->add_cap( 'edit_sp_tables' );
|
||||
$role->add_cap( 'edit_published_sp_tables' );
|
||||
$role->add_cap( 'edit_private_sp_tables' );
|
||||
$role->add_cap( 'edit_others_sp_tables' );
|
||||
$role->add_cap( 'delete_sp_table' );
|
||||
$role->add_cap( 'delete_published_sp_tables' );
|
||||
$role->add_cap( 'delete_private_sp_tables' );
|
||||
$role->add_cap( 'delete_others_sp_tables' );
|
||||
$role->add_cap( 'publish_sp_tables' );
|
||||
|
||||
// Players
|
||||
$role->add_cap( 'read_sp_players' );
|
||||
$role->add_cap( 'read_private_sp_players' );
|
||||
$role->add_cap( 'edit_sp_player' );
|
||||
$role->add_cap( 'edit_sp_players' );
|
||||
$role->add_cap( 'edit_published_sp_players' );
|
||||
$role->add_cap( 'edit_private_sp_players' );
|
||||
$role->add_cap( 'edit_others_sp_players' );
|
||||
$role->add_cap( 'delete_sp_player' );
|
||||
$role->add_cap( 'delete_published_sp_players' );
|
||||
$role->add_cap( 'delete_private_sp_players' );
|
||||
$role->add_cap( 'delete_others_sp_players' );
|
||||
$role->add_cap( 'publish_sp_players' );
|
||||
|
||||
// Player Lists
|
||||
$role->add_cap( 'read_sp_lists' );
|
||||
$role->add_cap( 'read_private_sp_lists' );
|
||||
$role->add_cap( 'edit_sp_list' );
|
||||
$role->add_cap( 'edit_sp_lists' );
|
||||
$role->add_cap( 'edit_published_sp_lists' );
|
||||
$role->add_cap( 'edit_private_sp_lists' );
|
||||
$role->add_cap( 'edit_others_sp_lists' );
|
||||
$role->add_cap( 'delete_sp_list' );
|
||||
$role->add_cap( 'delete_published_sp_lists' );
|
||||
$role->add_cap( 'delete_private_sp_lists' );
|
||||
$role->add_cap( 'delete_others_sp_lists' );
|
||||
$role->add_cap( 'publish_sp_lists' );
|
||||
|
||||
// Staff
|
||||
$role->add_cap( 'read_sp_staffs' );
|
||||
$role->add_cap( 'read_private_sp_staffs' );
|
||||
$role->add_cap( 'edit_sp_staff' );
|
||||
$role->add_cap( 'edit_sp_staffs' );
|
||||
$role->add_cap( 'edit_published_sp_staffs' );
|
||||
$role->add_cap( 'edit_private_sp_staffs' );
|
||||
$role->add_cap( 'edit_others_sp_staffs' );
|
||||
$role->add_cap( 'delete_sp_staff' );
|
||||
$role->add_cap( 'delete_published_sp_staffs' );
|
||||
$role->add_cap( 'delete_private_sp_staffs' );
|
||||
$role->add_cap( 'delete_others_sp_staffs' );
|
||||
$role->add_cap( 'publish_sp_staffs' );
|
||||
|
||||
// Settings
|
||||
$role->add_cap( 'read_sp_configs' );
|
||||
$role->add_cap( 'read_private_sp_configs' );
|
||||
$role->add_cap( 'edit_sp_config' );
|
||||
$role->add_cap( 'edit_sp_configs' );
|
||||
$role->add_cap( 'edit_published_sp_configs' );
|
||||
$role->add_cap( 'edit_private_sp_configs' );
|
||||
$role->add_cap( 'edit_others_sp_configs' );
|
||||
$role->add_cap( 'delete_sp_config' );
|
||||
$role->add_cap( 'delete_published_sp_configs' );
|
||||
$role->add_cap( 'delete_private_sp_configs' );
|
||||
$role->add_cap( 'delete_others_sp_configs' );
|
||||
$role->add_cap( 'publish_sp_configs' );
|
||||
foreach( $admin_capabilities as $capability ):
|
||||
$role->add_cap( $capability );
|
||||
endforeach;
|
||||
|
||||
// Team Manager
|
||||
remove_role( 'sp_team_manager' );
|
||||
|
||||
@@ -1,27 +1,13 @@
|
||||
<?php
|
||||
function sportspress_the_content( $content ) {
|
||||
sportspress_set_post_views( get_the_ID() );
|
||||
|
||||
if ( is_singular( 'sp_event' ) && in_the_loop() ):
|
||||
$content = apply_filters( 'sportspress_event_content', $content );
|
||||
elseif ( is_singular( 'sp_calendar' ) && in_the_loop() ):
|
||||
$content = apply_filters( 'sportspress_calendar_content', $content );
|
||||
elseif ( is_singular( 'sp_team' ) && in_the_loop() ):
|
||||
$content = apply_filters( 'sportspress_team_content', $content );
|
||||
elseif ( is_singular( 'sp_table' ) && in_the_loop() ):
|
||||
$content = apply_filters( 'sportspress_table_content', $content );
|
||||
elseif ( is_singular( 'sp_list' ) && in_the_loop() ):
|
||||
$content = apply_filters( 'sportspress_list_content', $content );
|
||||
elseif ( is_singular( 'sp_player' ) && in_the_loop() ):
|
||||
$content = apply_filters( 'sportspress_player_content', $content );
|
||||
endif;
|
||||
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'the_content', 'sportspress_the_content' );
|
||||
add_filter( 'get_the_content', 'sportspress_the_content' );
|
||||
|
||||
function sportspress_default_event_content( $content ) {
|
||||
if ( is_singular( 'sp_event' ) && in_the_loop() ):
|
||||
$details = sportspress_event_details();
|
||||
$results = sportspress_event_results();
|
||||
$players = sportspress_event_players();
|
||||
@@ -29,38 +15,54 @@ function sportspress_default_event_content( $content ) {
|
||||
if ( ! empty( $results ) )
|
||||
return $results . $details . $players . $staff . $content;
|
||||
$venue = sportspress_event_venue();
|
||||
return $details . $venue . $players . $staff . $content;
|
||||
$content = $details . $venue . $players . $staff . $content;
|
||||
endif;
|
||||
}
|
||||
add_filter( 'sportspress_event_content', 'sportspress_default_event_content' );
|
||||
add_filter( 'the_content', 'sportspress_default_event_content' );
|
||||
|
||||
function sportspress_default_calendar_content( $content ) {
|
||||
if ( is_singular( 'sp_calendar' ) && in_the_loop() ):
|
||||
$calendar = sportspress_events_calendar();
|
||||
return $calendar . $content;
|
||||
$content = $calendar . $content;
|
||||
endif;
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'sportspress_calendar_content', 'sportspress_default_calendar_content' );
|
||||
add_filter( 'the_content', 'sportspress_default_calendar_content' );
|
||||
|
||||
function sportspress_default_team_content( $content ) {
|
||||
if ( is_singular( 'sp_team' ) && in_the_loop() ):
|
||||
$columns = sportspress_team_columns();
|
||||
return $content . $columns;
|
||||
$content = $content . $columns;
|
||||
endif;
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'sportspress_team_content', 'sportspress_default_team_content' );
|
||||
add_filter( 'the_content', 'sportspress_default_team_content' );
|
||||
|
||||
function sportspress_default_table_content( $content ) {
|
||||
if ( is_singular( 'sp_table' ) && in_the_loop() ):
|
||||
$table = sportspress_league_table();
|
||||
$excerpt = has_excerpt() ? wpautop( get_the_excerpt() ) : '';
|
||||
return $table . $content . $excerpt;
|
||||
$content = $table . $content . $excerpt;
|
||||
endif;
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'sportspress_table_content', 'sportspress_default_table_content' );
|
||||
add_filter( 'the_content', 'sportspress_default_table_content' );
|
||||
|
||||
function sportspress_default_player_content( $content ) {
|
||||
if ( is_singular( 'sp_list' ) && in_the_loop() ):
|
||||
$metrics = sportspress_player_metrics();
|
||||
$statistics = sportspress_player_statistics();
|
||||
return $metrics . $statistics . $content;
|
||||
$content = $metrics . $statistics . $content;
|
||||
endif;
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'sportspress_player_content', 'sportspress_default_player_content' );
|
||||
add_filter( 'the_content', 'sportspress_default_player_content' );
|
||||
|
||||
function sportspress_default_list_content( $content ) {
|
||||
if ( is_singular( 'sp_player' ) && in_the_loop() ):
|
||||
$list = sportspress_player_list( get_the_ID() );
|
||||
return $list . $content;
|
||||
$content = $list . $content;
|
||||
endif;
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'sportspress_list_content', 'sportspress_default_list_content' );
|
||||
add_filter( 'the_content', 'sportspress_default_list_content' );
|
||||
|
||||
@@ -34,6 +34,8 @@ function sportspress_event_meta_init( $post ) {
|
||||
|
||||
remove_meta_box( 'submitdiv', 'sp_event', 'side' );
|
||||
remove_meta_box( 'sp_venuediv', 'sp_event', 'side' );
|
||||
remove_meta_box( 'sp_leaguediv', 'sp_event', 'side' );
|
||||
remove_meta_box( 'sp_seasondiv', 'sp_event', 'side' );
|
||||
|
||||
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' );
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_event_details_meta', 'sp_event', 'side', 'high' );
|
||||
|
||||
@@ -39,6 +39,7 @@ function sportspress_list_meta_init( $post ) {
|
||||
$players = (array)get_post_meta( $post->ID, 'sp_player', false );
|
||||
|
||||
remove_meta_box( 'sp_seasondiv', 'sp_list', 'side' );
|
||||
remove_meta_box( 'sp_leaguediv', 'sp_list', 'side' );
|
||||
add_meta_box( 'sp_playerdiv', __( 'Players', 'sportspress' ), 'sportspress_list_player_meta', 'sp_list', 'side', 'high' );
|
||||
|
||||
if ( $players && $players != array(0) ):
|
||||
|
||||
@@ -24,7 +24,8 @@ if ( !function_exists( 'sportspress_event_details' ) ) {
|
||||
|
||||
$output = '<h3>' . __( 'Details', 'sportspress' ) . '</h3>';
|
||||
|
||||
$output .= '<table class="sp-event-details sp-data-table"><tbody>';
|
||||
$output .= '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-event-details sp-data-table sp-responsive-table"><tbody>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
@@ -39,7 +40,7 @@ if ( !function_exists( 'sportspress_event_details' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody></table>';
|
||||
$output .= '</tbody></table></div>';
|
||||
|
||||
return apply_filters( 'sportspress_event_details', $output );
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
|
||||
|
||||
$output .= '<h3>' . get_the_title( $team_id ) . '</h3>';
|
||||
|
||||
$output .= '<table class="sp-event-statistics sp-data-table">' . '<thead>' . '<tr>';
|
||||
$output .= '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-event-statistics sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
$output .= '<th class="data-number">#</th>';
|
||||
$output .= '<th class="data-number">' . __( 'Player', 'sportspress' ) . '</th>';
|
||||
@@ -93,7 +94,7 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
|
||||
|
||||
endif;
|
||||
|
||||
$output .= '</table>';
|
||||
$output .= '</table>' . '</div>';
|
||||
|
||||
endforeach;
|
||||
|
||||
|
||||
@@ -47,14 +47,15 @@ if ( !function_exists( 'sportspress_event_results' ) ) {
|
||||
|
||||
$output .= '<h3>' . __( 'Results', 'sportspress' ) . '</h3>';
|
||||
|
||||
$output .= '<table class="sp-event-results sp-data-table"><thead>';
|
||||
$output .= '<th class="data-name">' . __( 'Team', 'sportspress' ) . '</th>';
|
||||
$output .= '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-event-results sp-data-table sp-responsive-table"><thead>' .
|
||||
'<th class="data-name">' . __( 'Team', 'sportspress' ) . '</th>';
|
||||
foreach( $result_labels as $key => $label ):
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
endforeach;
|
||||
$output .= '</tr>' . '</thead>' . '<tbody>';
|
||||
$output .= $table_rows;
|
||||
$output .= '</tbody></table>';
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||
$title = sizeof( $terms ) ? implode( ' — ', $terms ) : get_the_title( $id );
|
||||
|
||||
$output = '<h4 class="sp-table-caption">' . $title . '</h4>' .
|
||||
'<table class="sp-league-table sp-data-table">' . '<thead>' . '<tr>';
|
||||
'<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-league-table sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
$data = sportspress_get_league_table_data( $id );
|
||||
|
||||
@@ -73,7 +74,7 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody>' . '</table>';
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
return apply_filters( 'sportspress_league_table', $output );
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
return false;
|
||||
|
||||
$output = '<h4 class="sp-table-caption">' . $league->name . '</h4>' .
|
||||
'<table class="sp-player-statistics sp-data-table">' . '<thead>' . '<tr>';
|
||||
'<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-statistics sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
@@ -45,7 +46,7 @@ if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody>' . '</table>';
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
return apply_filters( 'sportspress_player_league_statistics', $output );
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
|
||||
$data = sportspress_get_player_list_data( $id );
|
||||
|
||||
$output = '<table class="sp-player-list sp-data-table">' . '<thead>' . '<tr>';
|
||||
$output = '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-list sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
// The first row should be column labels
|
||||
$labels = $data[0];
|
||||
@@ -49,7 +50,7 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody>' . '</table>';
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
return apply_filters( 'sportspress_player_list', $output );
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ if ( !function_exists( 'sportspress_player_metrics' ) ) {
|
||||
|
||||
$data = array_merge( $common, $metrics );
|
||||
|
||||
$output = '<table class="sp-player-metrics sp-data-table">' . '<tbody>';
|
||||
$output = '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-metrics sp-data-table sp-responsive-table">' . '<tbody>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
@@ -30,7 +31,7 @@ if ( !function_exists( 'sportspress_player_metrics' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody>' . '</table>';
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
return apply_filters( 'sportspress_player_metrics', $output );
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ if ( !function_exists( 'sportspress_team_columns' ) ) {
|
||||
unset( $data[0] );
|
||||
|
||||
$output .= '<h4 class="sp-table-caption">' . $league->name . '</h4>' .
|
||||
'<table class="sp-team-columns sp-data-table">' . '<thead>' . '<tr>';
|
||||
'<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-team-columns sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
@@ -51,7 +52,7 @@ if ( !function_exists( 'sportspress_team_columns' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody>' . '</table>';
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
@@ -36,3 +36,55 @@
|
||||
.sp-google-map {
|
||||
height: 320px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 40em) {
|
||||
.sp-responsive-table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.sp-pinned-table {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 50%;
|
||||
overflow: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.sp-pinned-table table {
|
||||
border-right: none;
|
||||
border-left: none;
|
||||
width: 100%;
|
||||
}
|
||||
.sp-pinned-table table th,
|
||||
.sp-pinned-table table td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sp-pinned-table td:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.sp-responsive-table-wrapper {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
.sp-responsive-table-wrapper .scrollable {
|
||||
margin-left: 50%;
|
||||
}
|
||||
.sp-responsive-table-wrapper .scrollable {
|
||||
overflow: scroll;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.sp-responsive-table td,
|
||||
.sp-responsive-table th {
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.sp-responsive-table .data-number,
|
||||
.sp-responsive-table .data-name,
|
||||
.sp-responsive-.sp-pinned-table td {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,16 @@
|
||||
function viewport() {
|
||||
var e = window, a = 'inner';
|
||||
if (!('innerWidth' in window )) {
|
||||
a = 'client';
|
||||
e = document.documentElement || document.body;
|
||||
}
|
||||
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
|
||||
}
|
||||
|
||||
(function($) {
|
||||
|
||||
// Data Tables
|
||||
// Data tables
|
||||
if (viewport().width > 640) {
|
||||
$(".sp-data-table").dataTable({
|
||||
"aaSorting": [],
|
||||
"bAutoWidth": false,
|
||||
@@ -15,6 +25,73 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Responsive tables
|
||||
var switched = false;
|
||||
var updateTables = function() {
|
||||
if ((viewport().width <= 640) && !switched ){
|
||||
switched = true;
|
||||
$(".sp-responsive-table").each(function(i, element) {
|
||||
splitTable($(element));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
else if (switched && (viewport().width > 640)) {
|
||||
switched = false;
|
||||
$(".sp-responsive-table").each(function(i, element) {
|
||||
unsplitTable($(element));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(window).load(updateTables);
|
||||
$(window).on("redraw",function(){switched=false;updateTables();}); // An event to listen for
|
||||
$(window).on("resize", updateTables);
|
||||
|
||||
|
||||
function splitTable(original)
|
||||
{
|
||||
original.wrap("<div class='sp-responsive-table-wrapper' />");
|
||||
|
||||
var copy = original.clone();
|
||||
copy.find("td:not(.data-number):not(.data-name), th:not(.data-number):not(.data-name)").css("display", "none");
|
||||
copy.removeClass("sp-responsive-table");
|
||||
|
||||
original.closest(".sp-responsive-table-wrapper").append(copy);
|
||||
copy.wrap("<div class='sp-pinned-table' />");
|
||||
original.wrap("<div class='scrollable' />");
|
||||
|
||||
setCellHeights(original, copy);
|
||||
}
|
||||
|
||||
function unsplitTable(original) {
|
||||
original.closest(".sp-responsive-table-wrapper").find(".sp-pinned-table").remove();
|
||||
original.unwrap();
|
||||
original.unwrap();
|
||||
}
|
||||
|
||||
function setCellHeights(original, copy) {
|
||||
var tr = original.find('tr'),
|
||||
tr_copy = copy.find('tr'),
|
||||
heights = [];
|
||||
|
||||
tr.each(function (index) {
|
||||
var self = $(this),
|
||||
tx = self.find('th, td');
|
||||
|
||||
tx.each(function () {
|
||||
var height = $(this).outerHeight(true);
|
||||
heights[index] = heights[index] || 0;
|
||||
if (height > heights[index]) heights[index] = height;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
tr_copy.each(function (index) {
|
||||
$(this).height(heights[index]);
|
||||
});
|
||||
}
|
||||
|
||||
// Google Maps
|
||||
function initialize_google_maps() {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
=== SportsPress ===
|
||||
Contributors: themeboy
|
||||
Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable
|
||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
|
||||
Requires at least: 3.5
|
||||
Tested up to: 3.8
|
||||
Stable tag: 0.1.10
|
||||
Stable tag: 0.2
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
@@ -12,17 +13,17 @@ SportsPress is a flexible sports management plugin that adds team management fun
|
||||
== Installation ==
|
||||
|
||||
= Minimum Requirements =
|
||||
* WordPress 3.5 or greater
|
||||
* WordPress 3.5 or greater (WordPress 3.8 recommended)
|
||||
* PHP version 5.2.4 or greater
|
||||
* MySQL version 5.0 or greater
|
||||
|
||||
= Automatic installation =
|
||||
= Automatic Installation =
|
||||
|
||||
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t even need to leave your web browser. To do an automatic install of SportsPress, log in to your WordPress admin panel, navigate to the Plugins menu and click Add New.
|
||||
|
||||
In the search field type “SportsPress” and click Search Plugins. Once you’ve found our sports plugin you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking Install Now. After clicking that link you will be asked if you’re sure you want to install the plugin. Click yes and WordPress will automatically complete the installation.
|
||||
|
||||
= Manual installation =
|
||||
= Manual Installation =
|
||||
|
||||
The manual installation method involves downloading our sports plugin and uploading it to your webserver via your favorite FTP application.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Plugin Name: SportsPress
|
||||
Plugin URI: http://themeboy.com/sportspress
|
||||
Description: Manage your club and its players, staff, events, league tables, and player lists.
|
||||
Version: 0.1.10
|
||||
Version: 0.2
|
||||
Author: ThemeBoy
|
||||
Author URI: http://themeboy.com/
|
||||
License: GPLv3
|
||||
@@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'SPORTSPRESS_VERSION', '0.1.10' );
|
||||
define( 'SPORTSPRESS_VERSION', '0.2' );
|
||||
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
||||
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
|
||||
|
||||
Reference in New Issue
Block a user