Add filter to shortcode template meta box
This commit is contained in:
@@ -25,7 +25,7 @@ class SP_Meta_Box_Calendar_Shortcode {
|
||||
<p class="howto">
|
||||
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
||||
</p>
|
||||
<p><input type="text" value="[event_<?php echo $the_format; ?> <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( 'event_' . $the_format, $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class SP_Meta_Box_Event_Shortcode {
|
||||
<p>
|
||||
<strong><?php echo $label; ?></strong>
|
||||
</p>
|
||||
<p><input type="text" value="[<?php echo $id; ?> <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( $id, $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class SP_Meta_Box_List_Shortcode {
|
||||
<p class="howto">
|
||||
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
||||
</p>
|
||||
<p><input type="text" value="[player_<?php echo $the_format; ?> <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( 'player_' . $the_format, $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,11 @@ class SP_Meta_Box_Player_Shortcode {
|
||||
<p>
|
||||
<strong><?php _e( 'Details', 'sportspress' ); ?></strong>
|
||||
</p>
|
||||
<p><input type="text" value="[player_details <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( 'player_details', $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<p>
|
||||
<strong><?php _e( 'Statistics', 'sportspress' ); ?></strong>
|
||||
</p>
|
||||
<p><input type="text" value="[player_statistics <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( 'player_statistics', $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class SP_Meta_Box_Staff_Shortcode {
|
||||
<p class="howto">
|
||||
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
||||
</p>
|
||||
<p><input type="text" value="[staff <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( 'staff', $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class SP_Meta_Box_Table_Shortcode {
|
||||
<p class="howto">
|
||||
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
||||
</p>
|
||||
<p><input type="text" value="[league_table <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="<?php sp_shortcode_template( 'league_table', $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -74,11 +74,11 @@ function sp_get_template( $template_name, $args = array(), $template_path = '',
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'sportspress_before_template_part', $template_name, $template_path, $located, $args );
|
||||
do_action( 'sportspress_before_template', $template_name, $template_path, $located, $args );
|
||||
|
||||
include( $located );
|
||||
|
||||
do_action( 'sportspress_after_template_part', $template_name, $template_path, $located, $args );
|
||||
do_action( 'sportspress_after_template', $template_name, $template_path, $located, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1196,6 +1196,10 @@ function sp_get_text_options() {
|
||||
return array_unique( $strings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a link to review SportsPress
|
||||
* @return null
|
||||
*/
|
||||
function sp_review_link() {
|
||||
?>
|
||||
<p>
|
||||
@@ -1205,3 +1209,30 @@ function sp_review_link() {
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Return shortcode template for meta boxes
|
||||
* @return null
|
||||
*/
|
||||
function sp_get_shortcode_template( $shortcode, $id = null, $args = array() ) {
|
||||
$args = apply_filters( 'sportspress_shortcode_template_args', $args );
|
||||
$output = '[' . $shortcode;
|
||||
if ( $id ) {
|
||||
$output .= ' ' . $id;
|
||||
}
|
||||
if ( sizeof( $args ) ) {
|
||||
foreach ( $args as $key => $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 );
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user