From e511c6e1776bc980dcc0ec5e41c4f8fcfdc42486 Mon Sep 17 00:00:00 2001 From: Paresh Radadiya Date: Sat, 13 Jan 2018 08:38:20 +0530 Subject: [PATCH] Fix - Include staff name and profile in [staff] shortcode --- .gitignore | 3 +- .../shortcodes/class-sp-shortcode-staff.php | 5 +++- templates/staff-content.php | 23 +++++++++++++++ templates/staff-excerpt.php | 23 +++++++++++++++ templates/staff-header.php | 28 +++++++++++++++++++ 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 templates/staff-content.php create mode 100644 templates/staff-excerpt.php create mode 100644 templates/staff-header.php diff --git a/.gitignore b/.gitignore index e106a1b4..d383a8c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .htaccess *.log -.DS_STORE \ No newline at end of file +.DS_STORE +.idea/ \ No newline at end of file diff --git a/includes/shortcodes/class-sp-shortcode-staff.php b/includes/shortcodes/class-sp-shortcode-staff.php index 33db0a99..743bd0cf 100644 --- a/includes/shortcodes/class-sp-shortcode-staff.php +++ b/includes/shortcodes/class-sp-shortcode-staff.php @@ -19,7 +19,10 @@ class SP_Shortcode_Staff { if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) $atts['id'] = $atts[0]; - sp_get_template( 'staff-photo.php', $atts ); + 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 ); } } diff --git a/templates/staff-content.php b/templates/staff-content.php new file mode 100644 index 00000000..5407acf1 --- /dev/null +++ b/templates/staff-content.php @@ -0,0 +1,23 @@ +post_content; +if ( $content ) { + ?> +
+
+
+ post_excerpt; +if ( $excerpt ) { + ?> +
+

+
+ post_title; +if ( $title ) { + + $staff = new SP_Staff( $id ); + $role = $staff->role(); + if ( $role ) + $title = '' . $role->name . ' ' . $title; + + ?> +
+

+
+