From 75ebf5ed48e5ba7bb5b9b85c0a6d0a4488b258d8 Mon Sep 17 00:00:00 2001 From: Eric Binnion Date: Mon, 2 Oct 2017 09:37:59 -0500 Subject: [PATCH] New build --- README.md | 30 +++++++++++++++++++++- class.jetpack-onboarding-end-points.php | 2 +- class.jetpack-onboarding-welcome-panel.php | 14 ++++++++-- jetpack-onboarding.php | 2 +- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c477b7f..31d317d 100644 --- a/README.md +++ b/README.md @@ -181,11 +181,39 @@ function add_jpo_wizard() { return; } ?> -
Loading Welcome Wizard
+ Jetpack_Onboarding_WelcomePanel::render_widget(); base ) { + // add assets + add_action( 'admin_enqueue_scripts', array( 'Jetpack_Onboarding_WelcomePanel', 'add_wizard_assets' ) ); + // add wizard HTML + add_action( 'admin_notices', 'add_jpo_wizard' ); + } +} + +function add_jpo_wizard() { + if ( get_option( Jetpack_Onboarding_EndPoints::HIDE_FOR_ALL_USERS_OPTION ) ) { + return; + } + + Jetpack_Onboarding_WelcomePanel::render_widget(); +} +``` + +If you decide to show the wizard on another page, you may also want to disable showing the wizard on the dashboard. To do this, you can do the following: + +```php +add_filter( 'jetpack_onboarding_show_on_dashboard', '__return_false' ); +``` + ## Styling ### Move the top of the wizard down to expose top elements in dashboard diff --git a/class.jetpack-onboarding-end-points.php b/class.jetpack-onboarding-end-points.php index 819a6bb..b401bc3 100644 --- a/class.jetpack-onboarding-end-points.php +++ b/class.jetpack-onboarding-end-points.php @@ -9,7 +9,7 @@ class Jetpack_Onboarding_EndPoints { const BUSINESS_ADDRESS_SAVED_KEY = 'jpo_business_address_saved'; const MAX_THEMES = 3; const NUM_RAND_THEMES = 3; - const VERSION = '1.7.1'; + const VERSION = '1.7.3'; const WOOCOMMERCE_ID = 'woocommerce/woocommerce.php'; const WOOCOMMERCE_SLUG = 'woocommerce'; const HIDE_FOR_ALL_USERS_OPTION = 'jpo_hide_always'; diff --git a/class.jetpack-onboarding-welcome-panel.php b/class.jetpack-onboarding-welcome-panel.php index 92f6a4d..c22ce44 100644 --- a/class.jetpack-onboarding-welcome-panel.php +++ b/class.jetpack-onboarding-welcome-panel.php @@ -7,8 +7,18 @@ class Jetpack_Onboarding_WelcomePanel { static function init() { add_filter( 'update_user_metadata', array( __CLASS__, 'check_for_widget_visibility' ), 10, 5 ); - add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_dashboard_widgets' ) ); - add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_wizard_assets' ) ); + + /** + * Should the Jetpack Onboarding wizard be displayed on the dashboard? + * + * @since 1.7.3 + * + * @param bool true Should the wizard be shown on the dashboard? + */ + if ( apply_filters( 'jetpack_onboarding_show_on_dashboard', true ) ) { + add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_dashboard_widgets' ) ); + add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_wizard_assets' ) ); + } } static function check_for_widget_visibility( $check, $object_id, $meta_key, $meta_value, $prev_value ) { diff --git a/jetpack-onboarding.php b/jetpack-onboarding.php index c6a9eef..92779c1 100644 --- a/jetpack-onboarding.php +++ b/jetpack-onboarding.php @@ -3,7 +3,7 @@ * Plugin Name: Jetpack Onboarding * Plugin URI: https://github.com/automattic/jetpack-onboarding * Description: Jetpack Onboarding Wizard. - * Version: 1.7.1 + * Version: 1.7.3 */ require_once( plugin_dir_path( __FILE__ ) . 'class.jetpack-onboarding-end-points.php' );