From e744ccbbb00a88d1b96ca1da5cb5760304cc82fa Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sun, 19 Oct 2014 23:25:36 +1100 Subject: [PATCH] Change sample player list layout --- includes/admin/class-sp-admin-sample-data.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/admin/class-sp-admin-sample-data.php b/includes/admin/class-sp-admin-sample-data.php index 64c1fe80..5fb35e2a 100644 --- a/includes/admin/class-sp-admin-sample-data.php +++ b/includes/admin/class-sp-admin-sample-data.php @@ -561,9 +561,23 @@ class SP_Admin_Sample_Data { // Get players from team $list_players = array_slice( $inserted_ids['sp_player'], $index * 4, 4 ); + // Get columns + $columns = array(); + $args = array( + 'post_type' => array( 'sp_metric' ), + 'posts_per_page' => 2, + 'orderby' => 'menu_order', + 'order' => 'ASC', + ); + $column_posts = get_posts( $args ); + foreach ( $column_posts as $column_post ) { + $columns[] = $column_post->post_name; + } + // Update meta - update_post_meta( $id, 'sp_format', 'gallery' ); + update_post_meta( $id, 'sp_format', 'list' ); sp_update_post_meta_recursive( $id, 'sp_player', $list_players ); + update_post_meta( $id, 'sp_columns', $columns ); update_post_meta( $id, 'sp_grouping', 'position' ); update_post_meta( $id, 'sp_orderby', 'name' ); update_post_meta( $id, 'sp_order', 'ASC' );