Add [staff_profile] shortcode for backward compatibility with sites already using [staff]

This commit is contained in:
Brian Miyaji
2018-01-22 01:30:24 +11:00
parent c0f9d1838e
commit fd21316b23
4 changed files with 41 additions and 4 deletions

View File

@@ -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="<?php sp_shortcode_template( 'staff', $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
<p><input type="text" value="<?php sp_shortcode_template( 'staff_profile', $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
<?php
}
}

View File

@@ -23,6 +23,7 @@ class SP_Shortcodes {
'player_details' => __CLASS__ . '::player_details',
'player_statistics' => __CLASS__ . '::player_statistics',
'staff' => __CLASS__ . '::staff',
'staff_profile' => __CLASS__ . '::staff_profile',
'event_calendar' => __CLASS__ . '::event_calendar',
'event_list' => __CLASS__ . '::event_list',
'event_blocks' => __CLASS__ . '::event_blocks',
@@ -232,4 +233,15 @@ class SP_Shortcodes {
public static function staff( $atts ) {
return self::shortcode_wrapper( array( 'SP_Shortcode_Staff', 'output' ), $atts );
}
/**
* Staff profile shortcode.
*
* @access public
* @param mixed $atts
* @return string
*/
public static function staff_profile( $atts ) {
return self::shortcode_wrapper( array( 'SP_Shortcode_Staff_Profile', 'output' ), $atts );
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Staff Profile Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Staff
* @version 1.4.7
*/
class SP_Shortcode_Staff_Profile {
/**
* Output the staff 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( 'staff-header.php', $atts );
sp_get_template( 'staff-photo.php', $atts );
sp_get_template( 'staff-details.php', $atts );
sp_get_template( 'staff-excerpt.php', $atts );
sp_get_template( 'staff-content.php', $atts );
}
}

View File

@@ -19,10 +19,7 @@ class SP_Shortcode_Staff {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
$atts['id'] = $atts[0];
sp_get_template( 'staff-header.php', $atts );
sp_get_template( 'staff-photo.php', $atts );
sp_get_template( 'staff-details.php', $atts );
sp_get_template( 'staff-excerpt.php', $atts );
sp_get_template( 'staff-content.php', $atts );
}
}