Use team website links and output template

This commit is contained in:
Brian Miyaji
2014-06-14 18:10:09 +10:00
parent 208089d4db
commit 6262bda6e8
5 changed files with 59 additions and 3 deletions

View File

@@ -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 {

View File

@@ -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}';

View File

@@ -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' ) ) {
/**

View File

@@ -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() ):

23
templates/team-link.php Normal file
View 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>