Use team website links and output template
This commit is contained in:
@@ -105,6 +105,12 @@
|
|||||||
max-height: 2em;
|
max-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Button */
|
||||||
|
.sp-button {
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/* Event Performance */
|
/* Event Performance */
|
||||||
.sp-event-performance .sub-in,
|
.sp-event-performance .sub-in,
|
||||||
.sp-event-performance .sub-out {
|
.sp-event-performance .sub-out {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class SP_Frontend_Scripts {
|
|||||||
echo ' /* SportsPress Frontend CSS */ ';
|
echo ' /* SportsPress Frontend CSS */ ';
|
||||||
|
|
||||||
if ( isset( $colors['primary'] ) )
|
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'] ) )
|
if ( isset( $colors['background'] ) )
|
||||||
echo '.sp-data-table tbody,.sp-calendar tbody{background: ' . $colors['background'] . ' !important}';
|
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}';
|
echo '.sp-data-table tbody,.sp-calendar tbody{color: ' . $colors['text'] . ' !important}';
|
||||||
|
|
||||||
if ( isset( $colors['heading'] ) )
|
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'] ) )
|
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}';
|
echo '.sp-data-table tbody a,.sp-data-table tbody a:hover,.sp-calendar tbody a:focus{color: ' . $colors['link'] . ' !important}';
|
||||||
|
|||||||
@@ -160,6 +160,19 @@ if ( ! function_exists( 'sportspress_output_calendar' ) ) {
|
|||||||
|
|
||||||
/** Single Team ********************************************************/
|
/** 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' ) ) {
|
if ( ! function_exists( 'sportspress_output_team_columns' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ add_action( 'sportspress_single_calendar_content', 'sportspress_output_calendar'
|
|||||||
*
|
*
|
||||||
* @see sportspress_output_team_columns()
|
* @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
|
* Single Table Content
|
||||||
@@ -207,6 +208,19 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
|
|||||||
}
|
}
|
||||||
add_filter( 'gettext', 'sportspress_gettext', 20, 3 );
|
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 ) {
|
function sportspress_pre_get_posts( $query ) {
|
||||||
|
|
||||||
if ( is_admin() ):
|
if ( is_admin() ):
|
||||||
|
|||||||
23
templates/team-link.php
Normal file
23
templates/team-link.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Team Link
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @package SportsPress/Templates
|
||||||
|
* @version 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! isset( $id ) )
|
||||||
|
$id = get_the_ID();
|
||||||
|
|
||||||
|
$url = get_post_meta( $id, 'sp_url', true );
|
||||||
|
|
||||||
|
if ( empty( $url ) )
|
||||||
|
return false;
|
||||||
|
?>
|
||||||
|
<form action="<?php echo $url; ?>">
|
||||||
|
<input type="submit" class="button sp-button sp-team-button" value="<?php _e( 'Visit Site', 'sportspress' ); ?>">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
Reference in New Issue
Block a user