setup_actions(); } return self::$instance; } /** * Sets up initial actions. * * @access private * @return void */ private function setup_actions() { // Display activation notice. add_action( 'load-themes.php', array( self::$instance, 'add_admin_notices' ) ); // Add theme's info page to the Dashboard menu. add_action( 'admin_menu', array( self::$instance, 'register_menu_page' ) ); // Add theme's info page scripts. add_action( 'admin_enqueue_scripts', array( self::$instance, 'admin_scripts' ) ); } /** * Load theme's info page styles. * * @access public * @return void */ public function admin_scripts() { global $pagenow; if ( 'themes.php' != $pagenow ) { return; } wp_enqueue_style( 'blogbaster-dashboard', BLOGBASTER_DIR_URI . '/inc/welcome-screen/assets/dashboard-style.css', false, '1.0.0' ); } /** * Create theme's info page. * * @access public * @return void */ public function register_menu_page() { add_theme_page( esc_html__( 'Underboot Dashboard', 'blogbaster' ), esc_html__( 'Theme Info', 'blogbaster' ), 'edit_theme_options', 'blogbaster-dashboard', array( self::$instance, 'theme_dashboard_page' ) ); } /** * Display a welcome notice upon successful activation. * * @access public * @return void */ public function add_admin_notices() { global $pagenow; if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( self::$instance, 'welcome_admin_notice' ) ); } } /** * Display a welcome notice when the theme is activated. * * @access public * @return void */ public function welcome_admin_notice() { $theme_data = wp_get_theme(); ?>
welcome page.', 'blogbaster' ), array( 'a' => array( 'href' => array() ) ) ), esc_attr( $theme_data->Name ), esc_url( admin_url( 'themes.php?page=blogbaster-dashboard' ) ) ); ?>