diff --git a/includes/admin/class-sp-admin-setup-wizard.php b/includes/admin/class-sp-admin-setup-wizard.php index c242932a..b3b474ad 100644 --- a/includes/admin/class-sp-admin-setup-wizard.php +++ b/includes/admin/class-sp-admin-setup-wizard.php @@ -78,8 +78,13 @@ class WC_Admin_Setup_Wizard { ), 'venue' => array( 'name' => __( 'Venue', 'sportspress' ), - 'view' => array( $this, 'sp_venue' ), - 'handler' => array( $this, 'sp_venue_save' ), + 'view' => array( $this, 'sp_setup_venue' ), + 'handler' => array( $this, 'sp_setup_venue_save' ), + ), + 'pages' => array( + 'name' => __( 'Pages', 'sportspress' ), + 'view' => array( $this, 'sp_setup_pages' ), + 'handler' => array( $this, 'sp_setup_pages_save' ) ), 'next_steps' => array( 'name' => __( 'Ready!', 'sportspress' ), @@ -352,13 +357,13 @@ class WC_Admin_Setup_Wizard {

- + - +

@@ -411,7 +416,7 @@ class WC_Admin_Setup_Wizard {

- + - +
    @@ -422,7 +427,7 @@ class WC_Admin_Setup_Wizard {
  • @@ -504,20 +509,20 @@ class WC_Admin_Setup_Wizard { /** * Venue Step. */ - public function sp_venue() { + public function sp_setup_venue() { ?>

    - + - +
    @@ -541,7 +546,7 @@ class WC_Admin_Setup_Wizard { /** * Venue Settings. */ - public function sp_venue_save() { + public function sp_setup_venue_save() { check_admin_referer( 'sp-setup' ); // Get home team @@ -573,6 +578,82 @@ class WC_Admin_Setup_Wizard { exit; } + /** + * Pages Step. + */ + public function sp_setup_pages() { + $pages = apply_filters( 'sportspress_setup_pages', array( + 'sp_calendar' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ), + 'sp_table' => __( 'Create automated league tables to keep track of team standings.', 'sportspress' ), + 'sp_list' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), + ) ); + ?> +

    + +

    ', '' ); ?>

    + + $description ) { ?> + + + + + + +
    labels->singular_name; ?>
    + +

    ', '', '', '' ); ?>

    + +

    + + + +

    + + __( 'Organize and publish calendars using different layouts.', 'sportspress' ), + 'sp_table' => __( 'Create automated league tables to keep track of team standings.', 'sportspress' ), + 'sp_list' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), + ) ); + + // Initialize post + $post = array( 'post_status' => 'publish' ); + + // Insert posts + foreach ( $pages as $post_type => $description ) { + $obj = get_post_type_object( $post_type ); + if ( ! is_object( $obj ) ) continue; + + // Skip if post exists + $posts = get_posts( array( 'posts_per_page' => 1, 'post_type' => $post_type ) ); + if ( $posts ) continue; + + // Add post args + $post['post_title'] = $obj->labels->singular_name; + $post['post_type'] = $post_type; + + // Insert post + $id = wp_insert_post( $post ); + + // Flag as sample + update_post_meta( $id, '_sp_sample', 1 ); + } + + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); + exit; + } + /** * Actions on the final step. */