'salient-welcome-screen' ), admin_url( 'index.php' ) ) ); } } /** * Redirect to welcome page when Salient is upgraded. * * @since 13.0 */ add_action('admin_init','nectar_upgrade_theme_welcome_redirect'); function nectar_upgrade_theme_welcome_redirect() { if( is_admin() && !wp_doing_ajax() && !is_customize_preview() ) { $on_welcome_page = ( isset($_GET['page']) && 'salient-welcome-screen' === $_GET['page'] ) ? true : false; $salient_current_version = nectar_get_theme_version(); $salient_upgrading_version = get_option('salient_upgrading_version'); // Do not redirect if network activated. if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } if( $salient_current_version != $salient_upgrading_version && false == $on_welcome_page && current_user_can('switch_themes') ) { update_option('salient_upgrading_version', $salient_current_version); // Skip redirect for minor releases. if ( !empty($salient_upgrading_version) && intval($salient_current_version) - intval($salient_upgrading_version) < 1 ) { return; } // Redirect. wp_safe_redirect( add_query_arg( array( 'page' => 'salient-welcome-screen' ), admin_url( 'index.php' ) ) ); } } } add_action('admin_menu', 'nectar_salient_welcome_page'); /** * Create Salient welcome page. * * @since 10.5 */ function nectar_salient_welcome_page() { add_dashboard_page( esc_html__( 'Welcome To Salient', 'salient' ), esc_html__( 'Welcome To Salient', 'salient' ), 'edit_theme_options', 'salient-welcome-screen', 'nectar_salient_welcome_content' ); } /** * Add welcome page content. * * @since 10.5 */ function nectar_salient_welcome_content() { $salient_theme_version = nectar_get_theme_version(); update_option('salient_upgrading_version', $salient_theme_version); ?>