display( 'Name' ), esc_html__( 'About', 'marinate' ) . ' ' . $theme->display( 'Name' ), 'activate_plugins', 'marinate-welcome', array( $this, 'welcome_screen' ) ); add_action( 'admin_print_styles-' . $page, array( $this, 'enqueue_styles' ) ); } /** * Enqueue styles. */ public function enqueue_styles() { $marinate_theme = wp_get_theme(); $marinate_version = $marinate_theme->get( 'Version' ); wp_enqueue_style( 'marinate-welcome', get_template_directory_uri() . '/inc/admin/css/admin-welcome.css', array(), $marinate_version ); } /** * Add admin notice. */ public function admin_notice() { global $marinate_version, $pagenow; wp_enqueue_style( 'marinate-message', get_template_directory_uri() . '/inc/admin/css/admin-welcome.css', array(), $marinate_version ); // Let's bail on theme activation. if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); update_option( 'Marinate_Admin_notice_welcome', 1 ); // No option? Let run the notice wizard again.. } elseif( ! get_option( 'Marinate_Admin_notice_welcome' ) ) { add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); } } /** * Hide a notice if the GET variable is set. */ public static function hide_notices() { if ( isset( $_GET['marinate-hide-notice'] ) && isset( $_GET['marinate_notice_nonce'] ) ) { if ( ! wp_verify_nonce( $_GET['marinate_notice_nonce'], 'marinate_hide_notices_nonce' ) ) { wp_die( esc_html( 'Action failed. Please refresh the page and retry.', 'marinate' ) ); } if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html( 'Cheatin’ huh?', 'marinate' ) ); } $hide_notice = sanitize_text_field( $_GET['marinate-hide-notice'] ); update_option( 'Marinate_Admin_notice_welcome', 1 ); } } /** * Show welcome notice. */ public function welcome_notice() { ?>