diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index 2056e6cd..82c57021 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -105,6 +105,12 @@ max-height: 2em; } +/* Button */ +.sp-button { + border: none; + cursor: pointer; +} + /* Event Performance */ .sp-event-performance .sub-in, .sp-event-performance .sub-out { diff --git a/includes/class-sp-frontend-scripts.php b/includes/class-sp-frontend-scripts.php index f4b4c756..88b81306 100644 --- a/includes/class-sp-frontend-scripts.php +++ b/includes/class-sp-frontend-scripts.php @@ -113,7 +113,7 @@ class SP_Frontend_Scripts { echo ' /* SportsPress Frontend CSS */ '; if ( isset( $colors['primary'] ) ) - echo '.sp-data-table th,.sp-calendar th,.sp-data-table tfoot,.sp-calendar tfoot{background:' . $colors['primary'] . ' !important}.sp-data-table tbody a,.sp-calendar tbody a{color:' . $colors['primary'] . ' !important}'; + echo '.sp-data-table th,.sp-calendar th,.sp-data-table tfoot,.sp-calendar tfoot,.sp-button{background:' . $colors['primary'] . ' !important}.sp-data-table tbody a,.sp-calendar tbody a{color:' . $colors['primary'] . ' !important}'; if ( isset( $colors['background'] ) ) echo '.sp-data-table tbody,.sp-calendar tbody{background: ' . $colors['background'] . ' !important}'; @@ -122,7 +122,7 @@ class SP_Frontend_Scripts { echo '.sp-data-table tbody,.sp-calendar tbody{color: ' . $colors['text'] . ' !important}'; if ( isset( $colors['heading'] ) ) - echo '.sp-data-table th,.sp-data-table th a,.sp-data-table tfoot,.sp-data-table tfoot a,.sp-calendar th,.sp-calendar th a,.sp-calendar tfoot,.sp-calendar tfoot a{color: ' . $colors['heading'] . ' !important}'; + echo '.sp-data-table th,.sp-data-table th a,.sp-data-table tfoot,.sp-data-table tfoot a,.sp-calendar th,.sp-calendar th a,.sp-calendar tfoot,.sp-calendar tfoot a,.sp-button{color: ' . $colors['heading'] . ' !important}'; if ( isset( $colors['link'] ) ) echo '.sp-data-table tbody a,.sp-data-table tbody a:hover,.sp-calendar tbody a:focus{color: ' . $colors['link'] . ' !important}'; diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php index cc8a004c..54c4d0f8 100644 --- a/includes/sp-template-functions.php +++ b/includes/sp-template-functions.php @@ -160,6 +160,19 @@ if ( ! function_exists( 'sportspress_output_calendar' ) ) { /** Single Team ********************************************************/ +if ( ! function_exists( 'sportspress_output_team_link' ) ) { + + /** + * Output the team link. + * + * @access public + * @subpackage Team/Link + * @return void + */ + function sportspress_output_team_link() { + sp_get_template( 'team-link.php' ); + } +} if ( ! function_exists( 'sportspress_output_team_columns' ) ) { /** diff --git a/includes/sp-template-hooks.php b/includes/sp-template-hooks.php index a70e373e..03ca6103 100644 --- a/includes/sp-template-hooks.php +++ b/includes/sp-template-hooks.php @@ -49,7 +49,8 @@ add_action( 'sportspress_single_calendar_content', 'sportspress_output_calendar' * * @see sportspress_output_team_columns() */ -add_action( 'sportspress_single_team_content', 'sportspress_output_team_columns', 10 ); +add_action( 'sportspress_single_team_content', 'sportspress_output_team_link', 10 ); +add_action( 'sportspress_single_team_content', 'sportspress_output_team_columns', 20 ); /** * Single Table Content @@ -207,6 +208,19 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) { } add_filter( 'gettext', 'sportspress_gettext', 20, 3 ); +function sportspress_team_permalink( $permalink, $post ) { + if ( ! is_admin() && 'sp_team' == get_post_type( $post ) ): + if ( empty( $post->post_content ) ): + $url = get_post_meta( $post->ID, 'sp_url', true ); + if ( ! empty( $url ) ): + return $url; + endif; + endif; + endif; + return $permalink; +} +add_filter( 'post_type_link', 'sportspress_team_permalink', 10, 2 ); + function sportspress_pre_get_posts( $query ) { if ( is_admin() ): diff --git a/templates/team-link.php b/templates/team-link.php new file mode 100644 index 00000000..7d8bcf04 --- /dev/null +++ b/templates/team-link.php @@ -0,0 +1,23 @@ + +
+ +
+
\ No newline at end of file