theme_name = $theme->parent()->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 = $theme->get_template(); $this->menu_name = sprintf( esc_html__( '%s', 'aytias' ), $this->theme_name ); $this->page_name = sprintf( esc_html__( '%s', 'aytias' ), $this->theme_name ); $this->page_slug = $this->theme_slug . '-welcome'; if ( current_user_can( 'manage_options' ) ) { add_action( 'admin_menu', array( $this, 'add_menu' ) ); add_action( 'admin_bar_menu', array( $this, 'add_bar_menu' ), 999 ); add_action( 'admin_notices', array( $this, 'display_admin_notice' ), 99 ); } add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'wp_ajax_aytias_dismiss', array( $this, 'dismiss_callback' ) ); add_action( 'wp_ajax_nopriv_aytias_dismiss', array( $this, 'dismiss_callback' ) ); } /** * Add theme dashboard page. * * @since 1.0.0 */ public function add_menu() { add_theme_page( $this->menu_name, $this->page_name, 'manage_options', $this->page_slug, array( $this, 'render_main_page') ); } /** * Add link in menu bar * * @since 1.0.0 */ public function add_bar_menu() { global $wp_admin_bar; if ( ! is_super_admin() || ! is_admin_bar_showing() ) { return; } $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => $this->page_slug, 'title' => $this->theme_name, 'href' => admin_url( "themes.php?page=$this->page_slug" ) ) ); } /** * Display notice in admin area * * @since 1.0.1 */ public function display_admin_notice(){ $screen_id = null; $current_screen = get_current_screen(); if ( $current_screen ) { $screen_id = $current_screen->id; } $user_id = get_current_user_id(); $dismiss_status = get_user_meta( $user_id, 'aytias_dismiss_status', true ); ?>
theme_name ) ) ;?>
page_slug" ) )?>" class="button button-primary"> theme_name )?>