plugins[] = array( 'value' => 'aftership', 'label' => 'AfterShip', 'path' => 'aftership-woocommerce-tracking/aftership.php' ); $this->plugins[] = array( 'value' => 'wc-shipment-tracking', 'label' => 'WooCommerce Shipment Tracking', 'path' => 'woocommerce-shipment-tracking/shipment-tracking.php' ); add_action('admin_menu', array($this, 'add_plugin_page')); add_action('admin_init', array($this, 'page_init')); add_action('admin_print_styles', array($this, 'admin_styles')); } public function admin_styles() { wp_enqueue_style('aftership_styles', plugins_url(basename(dirname(__FILE__))) . '/assets/css/admin.css'); } /** * Add options page */ public function add_plugin_page() { // This page will be under "Settings" add_options_page( 'AfterShip Settings Admin', 'AfterShip', 'manage_options', 'aftership-setting-admin', array($this, 'create_admin_page') ); } /** * Options page callback */ public function create_admin_page() { // Set class property $this->options = get_option('aftership_option_name'); ?>

AfterShip Settings

', isset($this->options['api_key']) ? esc_attr($this->options['api_key']) : '' ); printf( '

 How to generate AfterShip API Key?

' ); } public function plugin_callback() { $options = ""; foreach ($this->plugins as $plugin) { //print_r($plugin); if (WC_Dependencies::plugin_active_check($plugin['path'])) { $option = ''; $options .= $option; } } printf( '' ); } public function track_button_callback() { printf( '', (isset($this->options['use_track_button']) && $this->options['use_track_button'] === true) ? 'checked="checked"' : '' ); } } if (is_admin()) $aftership_settings = new AfterShip_Settings();