display( 'Name' ), esc_html__( 'About', 'semplicemente' ) . ' ' . $theme->display( 'Name' ), 'activate_plugins', 'semplicemente-welcome', array( $this, 'welcome_screen' ) ); } /** * Enqueue styles. */ public function enqueue_admin_scripts() { global $semplicemente_adminpage; $screen = get_current_screen(); if ( $screen->id != $semplicemente_adminpage ) { return; } wp_enqueue_style( 'semplicemente-welcome', get_template_directory_uri() . '/inc/admin/welcome.css', array(), '1.0' ); } /** * Add admin notice. */ public function admin_notice() { global $pagenow; wp_enqueue_style( 'semplicemente-message', get_template_directory_uri() . '/inc/admin/message.css', array(), '1.0' ); // Let's bail on theme activation. if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); update_option( 'semplicemente_admin_notice_welcome', 1 ); // No option? Let run the notice wizard again.. } elseif( ! get_option( 'semplicemente_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['semplicemente-hide-notice'] ) && isset( $_GET['_semplicemente_notice_nonce'] ) ) { if ( ! wp_verify_nonce( sanitize_key($_GET['_semplicemente_notice_nonce'] ), 'semplicemente_hide_notices_nonce' ) ) { wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'semplicemente' ) ); } if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Cheatin’ huh?', 'semplicemente' ) ); } $hide_notice = sanitize_text_field( wp_unslash($_GET['semplicemente-hide-notice'] )); update_option( 'semplicemente_admin_notice_' . $hide_notice, 1 ); } } /** * Show welcome notice. */ public function welcome_notice() { ?>