config = $config; self::$instance->krystal_setup_config(); self::$instance->krystal_setup_actions(); } } /** * Setup the class props based on the config array. */ public function krystal_setup_config() { $theme = wp_get_theme(); if ( is_child_theme() ) { $this->theme_name = $theme->get( 'Name' ); $this->theme = $theme->parent(); } else { $this->theme_name = $theme->get( 'Name' ); $this->theme = $theme->parent(); } $this->theme_version = $theme->get( 'Version' ); $this->theme_slug = 'krystal-business'; $this->notification = isset( $this->config['notification'] ) ? $this->config['notification'] : ( '

' . sprintf( 'Welcome! Thank you for choosing %1$s ! To take full advantage of this theme, please make sure you visit our %2$swelcome page%3$s.', $this->theme_name, '', '' ) . '

' . sprintf( 'Get started with %s', $this->theme_name ) . '

' ); } /** * Setup the actions used for this page. */ public function krystal_setup_actions() { /* activation notice */ add_action( 'load-themes.php', array( $this, 'krystal_activation_admin_notice' ) ); } /** * Adds an admin notice upon successful activation. */ public function krystal_activation_admin_notice() { global $pagenow; if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'krystal_about_page_welcome_admin_notice' ), 99 ); } } /** * Display an admin notice linking to the about page */ public function krystal_about_page_welcome_admin_notice() { if ( ! empty( $this->notification ) ) { echo '
'; echo wp_kses_post( $this->notification ); echo '
'; } } } } /** * Adding a About Krystal Business page */ add_action('admin_menu', 'krystal_business_add_menu'); function krystal_business_add_menu() { add_theme_page(esc_html__('About Krystal Business Theme','krystal-business'), esc_html__('About Krystal Business','krystal-business'),'manage_options', esc_html__('krystal-business-theme-info','krystal-business'), esc_html__('krystal_business_theme_info','krystal-business')); } /** * Callback */ function krystal_business_theme_info() { ?>