Add template loader to enable themed templates

This commit is contained in:
Brian Miyaji
2014-04-18 19:47:36 +10:00
parent 086a8f1955
commit 0ec3ec5669
39 changed files with 916 additions and 139 deletions

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying calendar content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-calendar.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_calendar hook
*/
do_action( 'sportspress_before_single_calendar' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_calendar_content' ); ?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying event content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-event.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_event hook
*/
do_action( 'sportspress_before_single_event' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_event_content' ); ?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying list content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-list.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_list hook
*/
do_action( 'sportspress_before_single_list' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_list_content' ); ?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying player content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-player.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_player hook
*/
do_action( 'sportspress_before_single_player' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_player_content' ); ?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying staff content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-staff.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_staff hook
*/
do_action( 'sportspress_before_single_staff' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_staff_content' ); ?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying table content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-table.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_table hook
*/
do_action( 'sportspress_before_single_table' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_table_content' ); ?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* The template for displaying team content.
*
* Override this template by copying it to yourtheme/sportspress/content-single-team.php
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php
/**
* sportspress_before_single_team hook
*/
do_action( 'sportspress_before_single_team' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<?php do_action( 'sportspress_single_team_content' ); ?>

View File

@@ -1,4 +1,14 @@
<?php
/**
* Countdown
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => null,
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Calendar
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
// Quick check. If we have no posts at all, abort!

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Details
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event List
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$primary_result = get_option( 'sportspress_primary_result', null );
$defaults = array(

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Performance
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Results
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Staff
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();
$staff = (array)get_post_meta( $id, 'sp_staff', false );

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Venue
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();
@@ -12,15 +22,15 @@ $link_venues = get_option( 'sportspress_event_link_venues', 'no' ) == 'yes' ? tr
foreach( $venues as $venue ):
$t_id = $venue->term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$meta = get_option( "taxonomy_$t_id" );
$name = $venue->name;
if ( $link_venues )
$name = '<a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $name . '</a>';
$address = sp_array_value( $term_meta, 'sp_address', '' );
$latitude = sp_array_value( $term_meta, 'sp_latitude', 0 );
$longitude = sp_array_value( $term_meta, 'sp_longitude', 0 );
$address = sp_array_value( $meta, 'sp_address', '' );
$latitude = sp_array_value( $meta, 'sp_latitude', 0 );
$longitude = sp_array_value( $meta, 'sp_longitude', 0 );
?>
<h3><?php echo SP()->text->string('Venue', 'event'); ?></h3>
<table class="sp-data-table sp-event-venue">
@@ -36,7 +46,7 @@ foreach( $venues as $venue ):
</tr>
<?php if ( $show_maps && $latitude != null && $longitude != null ): ?>
<tr>
<td><div class="sp-google-map" data-address="<?php echo $address; ?>" data-latitude="<?php echo $latitude; ?>" data-longitude="<?php echo $longitude; ?>"></div></td>
<td><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
</tr>
<?php endif; ?>
</tbody>

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event Video
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

View File

@@ -1,9 +0,0 @@
<?php
if ( ! isset( $id ) )
$id = get_the_ID();
sp_get_template( 'event-video.php', array( 'id' => $id ) );
sp_get_template( 'event-results.php', array( 'id' => $id ) );
sp_get_template( 'event-details.php', array( 'id' => $id ) );
sp_get_template( 'event-venue.php', array( 'id' => $id ) );
sp_get_template( 'event-performance.php', array( 'id' => $id ) );

View File

@@ -1,4 +1,14 @@
<?php
/**
* League Table
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => get_the_ID(),
'number' => -1,

View File

@@ -1,4 +1,14 @@
<?php
/**
* Player Gallery
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => get_the_ID(),
'number' => -1,

View File

@@ -1,4 +1,14 @@
<?php
/**
* Player League Performance
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $league ) )
return false;

View File

@@ -1,4 +1,14 @@
<?php
/**
* Player List
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => get_the_ID(),
'number' => -1,

View File

@@ -1,4 +1,14 @@
<?php
/**
* Player Metrics
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

View File

@@ -1,4 +1,14 @@
<?php
/**
* Player Performance
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

View File

@@ -1,4 +1,14 @@
<?php
/**
* Player Roster
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! $id )
$id = get_the_ID();

View File

@@ -1,6 +0,0 @@
<?php
if ( ! isset( $id ) )
$id = get_the_ID();
sp_get_template( 'player-metrics.php', array( 'id' => $id ) );
sp_get_template( 'player-performance.php', array( 'id' => $id ) );

View File

@@ -1,4 +1,14 @@
<?php
/**
* Team Columns
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();

23
templates/venue-map.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
/**
* Venue Map
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $meta ) )
return;
$address = sp_array_value( $meta, 'sp_address', null );
$latitude = sp_array_value( $meta, 'sp_latitude', null );
$longitude = sp_array_value( $meta, 'sp_longitude', null );
if ( $latitude != null && $longitude != null ):
?>
<div class="sp-google-map<?php if ( is_tax( 'sp_venue' ) ): ?> sp-venue-map<?php endif; ?>" data-address="<?php echo $address; ?>" data-latitude="<?php echo $latitude; ?>" data-longitude="<?php echo $longitude; ?>"></div>
<?php
endif;