From 1e35d206fa6651c17d9cfe1e18d0aadf39039562 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 9 Feb 2015 13:43:17 +1100 Subject: [PATCH] Add filter to shortcode template meta box --- .../class-sp-meta-box-calendar-shortcode.php | 2 +- .../class-sp-meta-box-event-shortcode.php | 2 +- .../class-sp-meta-box-list-shortcode.php | 2 +- .../class-sp-meta-box-player-shortcode.php | 4 +-- .../class-sp-meta-box-staff-shortcode.php | 2 +- .../class-sp-meta-box-table-shortcode.php | 2 +- includes/sp-core-functions.php | 35 +++++++++++++++++-- includes/sp-deprecated-functions.php | 11 ++++++ 8 files changed, 51 insertions(+), 9 deletions(-) diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-shortcode.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-shortcode.php index e15a5d5f..9e9b07bf 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-shortcode.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-shortcode.php @@ -25,7 +25,7 @@ class SP_Meta_Box_Calendar_Shortcode {

-

+

-

+

-

+

-

+

-

+

-

+

-

+

@@ -1205,3 +1209,30 @@ function sp_review_link() {

$value ) { + $output .= ' ' . $key . '="' . $value . '"'; + } + } + $output .= ']'; + return esc_attr( $output ); +} + +/** + * Display shortcode template for meta boxes + * @return null + */ +function sp_shortcode_template( $shortcode, $id = null, $args = array() ) { + echo sp_get_shortcode_template( $shortcode, $id, $args ); +} diff --git a/includes/sp-deprecated-functions.php b/includes/sp-deprecated-functions.php index f071503d..b119fc14 100644 --- a/includes/sp-deprecated-functions.php +++ b/includes/sp-deprecated-functions.php @@ -19,6 +19,17 @@ add_shortcode( 'league-table', 'SP_Shortcodes::league_table' ); add_shortcode( 'player-list', 'SP_Shortcodes::player_list' ); add_shortcode( 'player-gallery', 'SP_Shortcodes::player_gallery' ); +/* Actions */ +function sportspress_before_template_part_action( $template_name, $template_path, $located, $args ) { + do_action( 'sportspress_before_template_part', $template_name, $template_path, $located, $args ); +} +add_action( 'sportspress_before_template', 'sportspress_before_template_part_action', 10, 4 ); + +function sportspress_after_template_part_action( $template_name, $template_path, $located, $args ) { + do_action( 'sportspress_after_template_part', $template_name, $template_path, $located, $args ); +} +add_action( 'sportspress_after_template', 'sportspress_after_template_part_action', 10, 4 ); + /* Functions */ function sportspress_flush_rewrite_rules() { return sp_flush_rewrite_rules();