From c20f8c64a81217318b7aa6581577d73ef8a4bd6b Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 6 Jun 2017 16:28:24 +1000 Subject: [PATCH] Add team gallery shortcode to editor button with sorting option --- includes/class-sp-ajax.php | 64 ++++++++++++++++++++++++++++ includes/sp-formatting-functions.php | 11 +++++ templates/team-gallery.php | 14 +----- 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/includes/class-sp-ajax.php b/includes/class-sp-ajax.php index 95c7788f..c1bfe4d5 100644 --- a/includes/class-sp-ajax.php +++ b/includes/class-sp-ajax.php @@ -31,6 +31,7 @@ class SP_AJAX { 'event_list_shortcode' => false, 'event_blocks_shortcode' => false, 'team_standings_shortcode' => false, + 'team_gallery_shortcode' => false, 'player_details_shortcode' => false, 'player_statistics_shortcode' => false, 'player_list_shortcode' => false, @@ -682,6 +683,64 @@ class SP_AJAX { die(); } + /** + * AJAX team_gallery shortcode + */ + public function team_gallery_shortcode() { + ?> + + false, 'number' => -1, 'orderby' => 'default', - 'order' => 'ASC', 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', @@ -57,19 +56,10 @@ $data = $table->data(); // Remove the first row to leave us with the actual data unset( $data[0] ); -if ( $orderby == 'default' ): - $orderby = $table->orderby; - $order = $table->order; +if ( $orderby == 'name' ): + uasort( $data, 'sp_sort_by_name' ); elseif ( $orderby == 'rand' ): uasort( $data, 'sp_sort_random' ); -else: - $table->priorities = array( - array( - 'key' => $orderby, - 'order' => $order, - ), - ); - uasort( $data, array( $table, 'sort' ) ); endif; if ( $title )