New event blocks shortcode

This commit is contained in:
Brian Miyaji
2014-04-29 14:10:35 +10:00
parent 3629674013
commit 12932e0f55
3 changed files with 38 additions and 2 deletions

View File

@@ -20,8 +20,9 @@ class SP_Shortcodes {
'event_details' => __CLASS__ . '::event_details', 'event_details' => __CLASS__ . '::event_details',
'event_performance' => __CLASS__ . '::event_performance', 'event_performance' => __CLASS__ . '::event_performance',
'countdown' => __CLASS__ . '::countdown', 'countdown' => __CLASS__ . '::countdown',
'event_list' => __CLASS__ . '::event_list',
'event_calendar' => __CLASS__ . '::event_calendar', 'event_calendar' => __CLASS__ . '::event_calendar',
'event_list' => __CLASS__ . '::event_list',
'event_blocks' => __CLASS__ . '::event_blocks',
'league_table' => __CLASS__ . '::league_table', 'league_table' => __CLASS__ . '::league_table',
'player_list' => __CLASS__ . '::player_list', 'player_list' => __CLASS__ . '::player_list',
'player_gallery' => __CLASS__ . '::player_gallery', 'player_gallery' => __CLASS__ . '::player_gallery',
@@ -126,6 +127,17 @@ class SP_Shortcodes {
return self::shortcode_wrapper( array( 'SP_Shortcode_Event_List', 'output' ), $atts ); return self::shortcode_wrapper( array( 'SP_Shortcode_Event_List', 'output' ), $atts );
} }
/**
* Event blocks shortcode.
*
* @access public
* @param mixed $atts
* @return string
*/
public static function event_blocks( $atts ) {
return self::shortcode_wrapper( array( 'SP_Shortcode_Event_Blocks', 'output' ), $atts );
}
/** /**
* Team columns shortcode. * Team columns shortcode.
* *

View File

@@ -0,0 +1,24 @@
<?php
/**
* Event Blocks Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Blocks
* @version 0.8
*/
class SP_Shortcode_Event_Blocks {
/**
* Output the event blocks 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-blocks.php', $atts );
}
}

View File

@@ -217,7 +217,7 @@ add_filter( 'the_content', 'sportspress_content_post_views' );
add_filter( 'get_the_content', 'sportspress_content_post_views' ); add_filter( 'get_the_content', 'sportspress_content_post_views' );
function sportspress_widget_text( $content ) { function sportspress_widget_text( $content ) {
if ( ! preg_match( '/\[[\r\n\t ]*(countdown|events?(_|-)(results|details|performance|calendar|list)|team(_|-)columns|league(_|-)table|player(_|-)(metrics|performance|list|gallery))?[\r\n\t ].*?\]/', $content ) ) if ( ! preg_match( '/\[[\r\n\t ]*(countdown|events?(_|-)(results|details|performance|calendar|list|blocks)|team(_|-)columns|league(_|-)table|player(_|-)(metrics|performance|list|gallery))?[\r\n\t ].*?\]/', $content ) )
return $content; return $content;
$content = do_shortcode( $content ); $content = do_shortcode( $content );