display( 'Name' ), esc_html__( 'About', 'fitclub' ) . ' ' . $theme->display( 'Name' ), 'activate_plugins', 'fitclub-welcome', array( $this, 'welcome_screen', ) ); add_action( 'admin_print_styles-' . $page, array( $this, 'enqueue_styles' ) ); } /** * Enqueue styles. */ public function enqueue_styles() { global $fitclub_version; wp_enqueue_style( 'fitclub-welcome', get_template_directory_uri() . '/css/admin/welcome.css', array(), $fitclub_version ); } /** * Add admin notice. */ public function admin_notice() { global $fitclub_version, $pagenow; wp_enqueue_style( 'fitclub-message', get_template_directory_uri() . '/css/admin/message.css', array(), $fitclub_version ); // Let's bail on theme activation. if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); update_option( 'fitclub_admin_notice_welcome', 1 ); // No option? Let run the notice wizard again.. } else if ( ! get_option( 'fitclub_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['fitclub-hide-notice'] ) && isset( $_GET['_fitclub_notice_nonce'] ) ) { if ( ! wp_verify_nonce( $_GET['_fitclub_notice_nonce'], 'fitclub_hide_notices_nonce' ) ) { wp_die( __( 'Action failed. Please refresh the page and retry.', 'fitclub' ) ); } if ( ! current_user_can( 'manage_options' ) ) { wp_die( __( 'Cheatin’ huh?', 'fitclub' ) ); } $hide_notice = sanitize_text_field( $_GET['fitclub-hide-notice'] ); update_option( 'fitclub_admin_notice_' . $hide_notice, 1 ); } } /** * Show welcome notice. */ public function welcome_notice() { ?>