/** * Register menu pages * * @return void */ public function register_menu_pages() { $general_settings = get_option(self::$plugin_prefix . '_table_settings'); // Main menu page $screen_id = add_menu_page('Go Pricing', 'Go Pricing', isset($general_settings['capability']) ? $general_settings['capability'] : 'manage_options', self::$plugin_slug, array(__CLASS__, 'admin_page_router'), $this->plugin_url . 'assets/admin/images/go_logo_nav.png', 90.123); self::$screen_hooks[$screen_id] = array(__CLASS__, 'main_page'); // General Settings page self::add_submenu_page(__('General Settings', 'go_pricing_textdomain'), __('General Settings', 'go_pricing_textdomain'), isset($general_settings['capability']) ? $general_settings['capability'] : 'manage_options', self::$plugin_slug . '-settings', array($this, 'settings_page')); // Import & Export page self::add_submenu_page(__('Import & Export', 'go_pricing_textdomain'), __('Import & Export', 'go_pricing_textdomain'), isset($general_settings['capability']) ? $general_settings['capability'] : 'manage_options', self::$plugin_slug . '-import-export', array($this, 'impex_page')); // Admin menu page action do_action('go_pricing_menu_pages'); // Admin screen filter self::$screen_hooks = apply_filters('go_pricing_add_screen', self::$screen_hooks); }
/** * Enqueue admin styles * * @return void */ public function enqueue_admin_styles() { // Plugin screens filter self::$screen_hooks = apply_filters('go_pricing_add_screen', self::$screen_hooks); if (empty(self::$screen_hooks)) { return; } $screen = get_current_screen(); if (array_key_exists($screen->id, self::$screen_hooks)) { wp_enqueue_style(self::$plugin_slug . '-admin-styles', $this->plugin_url . 'assets/admin/css/go_pricing_admin_styles.css', array(), self::$plugin_version); wp_enqueue_style(self::$plugin_slug . '-font-awesome', $this->plugin_url . 'assets/lib/font_awesome/css/font-awesome.min.css', array(), self::$plugin_version); wp_enqueue_style(self::$plugin_slug . '-farbtastic', $this->plugin_url . 'assets/lib/farbtastic/farbtastic.css', array(), self::$plugin_version); } }