You've already forked wc-tier-and-package-prices
Release version 1.0.1
- Add Twig template engine integration - Migrate all templates to Twig format - Add German (Switzerland, Informal) translation - Improve template organization and security - Add Composer dependency management - Create comprehensive changelog
This commit is contained in:
48
includes/class-wc-tpp-admin.php
Normal file
48
includes/class-wc-tpp-admin.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin settings and configuration
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class WC_TPP_Admin {
|
||||
|
||||
public function __construct() {
|
||||
add_action('admin_menu', array($this, 'add_admin_menu'));
|
||||
add_action('admin_init', array($this, 'register_settings'));
|
||||
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
||||
}
|
||||
|
||||
public function add_admin_menu() {
|
||||
add_submenu_page(
|
||||
'woocommerce',
|
||||
__('Tier & Package Prices', 'wc-tier-package-prices'),
|
||||
__('Tier & Package Prices', 'wc-tier-package-prices'),
|
||||
'manage_woocommerce',
|
||||
'wc-tier-package-prices',
|
||||
array($this, 'settings_page')
|
||||
);
|
||||
}
|
||||
|
||||
public function register_settings() {
|
||||
register_setting('wc_tpp_settings', 'wc_tpp_enable_tier_pricing');
|
||||
register_setting('wc_tpp_settings', 'wc_tpp_enable_package_pricing');
|
||||
register_setting('wc_tpp_settings', 'wc_tpp_display_table');
|
||||
register_setting('wc_tpp_settings', 'wc_tpp_display_position');
|
||||
}
|
||||
|
||||
public function enqueue_admin_scripts($hook) {
|
||||
if ('woocommerce_page_wc-tier-package-prices' === $hook || 'post.php' === $hook || 'post-new.php' === $hook) {
|
||||
wp_enqueue_style('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/css/admin.css', array(), WC_TPP_VERSION);
|
||||
wp_enqueue_script('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/js/admin.js', array('jquery'), WC_TPP_VERSION, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function settings_page() {
|
||||
WC_TPP_Template_Loader::get_instance()->display('admin/settings-page.twig');
|
||||
}
|
||||
}
|
||||
|
||||
new WC_TPP_Admin();
|
||||
Reference in New Issue
Block a user