config = $config; self::$instance->own_store_setup_config(); self::$instance->own_store_setup_actions(); } } /** * Setup the class props based on the config array. */ public function own_store_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 = 'own-store'; $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 own_store_setup_actions() { /* activation notice */ add_action( 'load-themes.php', array( $this, 'own_store_activation_admin_notice' ) ); } /** * Adds an admin notice upon successful activation. */ public function own_store_activation_admin_notice() { global $pagenow; if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'own_store_about_page_welcome_admin_notice' ), 99 ); } } /** * Display an admin notice linking to the about page */ public function own_store_about_page_welcome_admin_notice() { if ( ! empty( $this->notification ) ) { echo '
'; echo wp_kses_post( $this->notification ); echo '
'; } } } } /** * Adding a About page */ add_action('admin_menu', 'own_store_add_menu'); function own_store_add_menu() { add_theme_page(esc_html__('About Own Store Theme','own-store'), esc_html__('Own Store Info','own-store'),'manage_options', esc_html__('own-store-theme-info','own-store'), esc_html__('own_store_theme_info','own-store')); } /** * Callback */ function own_store_theme_info() { ?>