display( 'Name' ), esc_html__( 'About', 'ansia' ) . ' ' . $theme->display( 'Name' ), 'activate_plugins', 'ansia-welcome', array( $this, 'welcome_screen' ) ); } /** * Enqueue styles. */ public function enqueue_admin_scripts() { global $ansia_adminpage; $screen = get_current_screen(); if ( $screen->id != $ansia_adminpage ) { return; } wp_enqueue_style( 'ansia-welcome', get_template_directory_uri() . '/inc/admin/welcome.css', array(), '1.0' ); wp_enqueue_script( 'ansia-admin-panel', get_template_directory_uri() . '/inc/admin/admin-panel.js', array('jquery'), '1.0', true ); } /** * Add admin notice. */ public function admin_notice() { global $pagenow; wp_enqueue_style( 'ansia-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( 'ansia_admin_notice_welcome', 1 ); // No option? Let run the notice wizard again.. } elseif( ! get_option( 'ansia_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['ansia-hide-notice'] ) && isset( $_GET['_ansia_notice_nonce'] ) ) { if ( ! wp_verify_nonce( sanitize_key($_GET['_ansia_notice_nonce'] ), 'ansia_hide_notices_nonce' ) ) { wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'ansia' ) ); } if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Cheatin’ huh?', 'ansia' ) ); } $hide_notice = sanitize_text_field( wp_unslash($_GET['ansia-hide-notice'] )); update_option( 'ansia_admin_notice_' . $hide_notice, 1 ); } } /** * Show welcome notice. */ public function welcome_notice() { ?>