Display 3 different shortcodes for event sections
This commit is contained in:
@@ -23,7 +23,18 @@ class SP_Meta_Box_Event_Shortcode {
|
|||||||
<p class="howto">
|
<p class="howto">
|
||||||
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
||||||
</p>
|
</p>
|
||||||
<p><input type="text" value="[event <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
|
<p>
|
||||||
|
<strong><?php _e( 'Results', 'sportspress' ); ?></strong>
|
||||||
|
</p>
|
||||||
|
<p><input type="text" value="[event_results <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
|
||||||
|
<p>
|
||||||
|
<strong><?php _e( 'Details', 'sportspress' ); ?></strong>
|
||||||
|
</p>
|
||||||
|
<p><input type="text" value="[event_details <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
|
||||||
|
<p>
|
||||||
|
<strong><?php _e( 'Performance', 'sportspress' ); ?></strong>
|
||||||
|
</p>
|
||||||
|
<p><input type="text" value="[event_performance <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ class SP_Post_types {
|
|||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_venue_slug', 'venue' ) ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_venue_slug', 'venue' ) ),
|
||||||
);
|
);
|
||||||
$object_types = array( 'sp_event', 'sp_calendar', 'attachment' );
|
$object_types = array( 'sp_event', 'sp_calendar' );
|
||||||
register_taxonomy( 'sp_venue', $object_types, $args );
|
register_taxonomy( 'sp_venue', $object_types, $args );
|
||||||
foreach ( $object_types as $object_type ):
|
foreach ( $object_types as $object_type ):
|
||||||
register_taxonomy_for_object_type( 'sp_league', $object_type );
|
register_taxonomy_for_object_type( 'sp_league', $object_type );
|
||||||
@@ -141,7 +141,7 @@ class SP_Post_types {
|
|||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_position_slug', 'position' ) ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_position_slug', 'position' ) ),
|
||||||
);
|
);
|
||||||
$object_types = array( 'sp_player', 'sp_performance', 'sp_metric', 'attachment' );
|
$object_types = array( 'sp_player', 'sp_performance', 'sp_metric' );
|
||||||
register_taxonomy( 'sp_position', $object_types, $args );
|
register_taxonomy( 'sp_position', $object_types, $args );
|
||||||
foreach ( $object_types as $object_type ):
|
foreach ( $object_types as $object_type ):
|
||||||
register_taxonomy_for_object_type( 'sp_league', $object_type );
|
register_taxonomy_for_object_type( 'sp_league', $object_type );
|
||||||
@@ -417,7 +417,7 @@ class SP_Post_types {
|
|||||||
'exclude_from_search' => false,
|
'exclude_from_search' => false,
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_teams_slug', 'teams' ) ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_teams_slug', 'teams' ) ),
|
||||||
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
|
'supports' => array( 'title', 'author', 'thumbnail', 'page-attributes' ),
|
||||||
'has_archive' => true,
|
'has_archive' => true,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'menu_icon' => 'dashicons-shield-alt',
|
'menu_icon' => 'dashicons-shield-alt',
|
||||||
@@ -478,7 +478,7 @@ class SP_Post_types {
|
|||||||
'exclude_from_search' => false,
|
'exclude_from_search' => false,
|
||||||
'hierarchical' => false,
|
'hierarchical' => false,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_players_slug', 'players' ) ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_players_slug', 'players' ) ),
|
||||||
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes' ),
|
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt', 'page-attributes' ),
|
||||||
'has_archive' => true,
|
'has_archive' => true,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'menu_icon' => 'dashicons-groups',
|
'menu_icon' => 'dashicons-groups',
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ class SP_Shortcodes {
|
|||||||
public static function init() {
|
public static function init() {
|
||||||
// Define shortcodes
|
// Define shortcodes
|
||||||
$shortcodes = array(
|
$shortcodes = array(
|
||||||
'event' => __CLASS__ . '::event',
|
'event_results' => __CLASS__ . '::event_results',
|
||||||
'countdown' => __CLASS__ . '::countdown',
|
'event_details' => __CLASS__ . '::event_details',
|
||||||
'event_list' => __CLASS__ . '::event_list',
|
'event_performance' => __CLASS__ . '::event_performance',
|
||||||
'event_calendar' => __CLASS__ . '::event_calendar',
|
'countdown' => __CLASS__ . '::countdown',
|
||||||
// 'team' => __CLASS__ . '::team',
|
'event_list' => __CLASS__ . '::event_list',
|
||||||
'league_table' => __CLASS__ . '::league_table',
|
'event_calendar' => __CLASS__ . '::event_calendar',
|
||||||
// 'player' => __CLASS__ . '::player',
|
'league_table' => __CLASS__ . '::league_table',
|
||||||
'player_list' => __CLASS__ . '::player_list',
|
'player_metrics' => __CLASS__ . '::player_metrics',
|
||||||
'player_gallery' => __CLASS__ . '::player_gallery',
|
'player_list' => __CLASS__ . '::player_list',
|
||||||
// 'staff' => __CLASS__ . '::staff',
|
'player_gallery' => __CLASS__ . '::player_gallery',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $shortcodes as $shortcode => $function ) {
|
foreach ( $shortcodes as $shortcode => $function ) {
|
||||||
@@ -62,14 +62,36 @@ class SP_Shortcodes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event shortcode.
|
* Event results shortcode.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $atts
|
* @param mixed $atts
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function event( $atts ) {
|
public static function event_results( $atts ) {
|
||||||
return self::shortcode_wrapper( array( 'SP_Shortcode_Event', 'output' ), $atts );
|
return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Results', 'output' ), $atts );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event details shortcode.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $atts
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function event_details( $atts ) {
|
||||||
|
return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Details', 'output' ), $atts );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event performance shortcode.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $atts
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function event_performance( $atts ) {
|
||||||
|
return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Performance', 'output' ), $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,14 +128,14 @@ class SP_Shortcodes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Team shortcode.
|
* Team columns shortcode.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $atts
|
* @param mixed $atts
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function team( $atts ) {
|
public static function team_columns( $atts ) {
|
||||||
return self::shortcode_wrapper( array( 'SP_Shortcode_Team', 'output' ), $atts );
|
return self::shortcode_wrapper( array( 'SP_Shortcode_Team_Columns', 'output' ), $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,14 +150,14 @@ class SP_Shortcodes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player shortcode.
|
* Player performance shortcode.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $atts
|
* @param mixed $atts
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function player( $atts ) {
|
public static function player_performance( $atts ) {
|
||||||
return self::shortcode_wrapper( array( 'SP_Shortcode_Player', 'output' ), $atts );
|
return self::shortcode_wrapper( array( 'SP_Shortcode_Player_Performance', 'output' ), $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Event Shortcode
|
* Event Details Shortcode
|
||||||
*
|
*
|
||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @category Shortcodes
|
* @category Shortcodes
|
||||||
* @package SportsPress/Shortcodes/Event
|
* @package SportsPress/Shortcodes/Event_Details
|
||||||
* @version 0.7
|
* @version 0.8
|
||||||
*/
|
*/
|
||||||
class SP_Shortcode_Event {
|
class SP_Shortcode_Event_Details {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output the event shortcode.
|
* Output the event details shortcode.
|
||||||
*
|
*
|
||||||
* @param array $atts
|
* @param array $atts
|
||||||
*/
|
*/
|
||||||
@@ -19,6 +19,6 @@ class SP_Shortcode_Event {
|
|||||||
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
|
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
|
||||||
$atts['id'] = $atts[0];
|
$atts['id'] = $atts[0];
|
||||||
|
|
||||||
sp_get_template( 'event.php', $atts );
|
sp_get_template( 'event-details.php', $atts );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
24
includes/shortcodes/class-sp-shortcode-event-performance.php
Normal file
24
includes/shortcodes/class-sp-shortcode-event-performance.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Event Performance Shortcode
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @category Shortcodes
|
||||||
|
* @package SportsPress/Shortcodes/Event_Performance
|
||||||
|
* @version 0.8
|
||||||
|
*/
|
||||||
|
class SP_Shortcode_Event_Performance {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the event performance shortcode.
|
||||||
|
*
|
||||||
|
* @param array $atts
|
||||||
|
*/
|
||||||
|
public static function output( $atts ) {
|
||||||
|
|
||||||
|
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
|
||||||
|
$atts['id'] = $atts[0];
|
||||||
|
|
||||||
|
sp_get_template( 'event-performance.php', $atts );
|
||||||
|
}
|
||||||
|
}
|
||||||
24
includes/shortcodes/class-sp-shortcode-event-results.php
Normal file
24
includes/shortcodes/class-sp-shortcode-event-results.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Event Results Shortcode
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @category Shortcodes
|
||||||
|
* @package SportsPress/Shortcodes/Event_Results
|
||||||
|
* @version 0.8
|
||||||
|
*/
|
||||||
|
class SP_Shortcode_Event_Results {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the event results shortcode.
|
||||||
|
*
|
||||||
|
* @param array $atts
|
||||||
|
*/
|
||||||
|
public static function output( $atts ) {
|
||||||
|
|
||||||
|
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
|
||||||
|
$atts['id'] = $atts[0];
|
||||||
|
|
||||||
|
sp_get_template( 'event-results.php', $atts );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user