Last active
June 25, 2023 04:48
-
-
Save ndugger/b1e4abe8952e33743ee2a05004dc9798 to your computer and use it in GitHub Desktop.
WooCommerce Custom Page Debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_menu', function() { | |
global $submenu; | |
PageController::get_instance()->register_page([ | |
'id' => 'woocommerce-software-manager-downloads', | |
'title' => __('Downloads', WC_SOFTWARE_MANAGER_TEXT_DOMAIN), | |
'path' => 'wc-admin&path=/software-manager', | |
'parent' => 'woocommerce-software-manager', | |
'nav_args' => array( | |
'parent' => 'woocommerce-software-manager', | |
'order' => 10, | |
), | |
]); | |
if (isset($submenu['woocommerce-software-manager'])) { | |
foreach ($submenu['woocommerce-software-manager'] as &$item) { | |
if (str_starts_with($item[2], 'wc-admin')) { | |
$item[2] = 'admin.php?page=' . $item[2]; | |
} | |
} | |
} | |
}, 5); | |
add_action('admin_menu', function() { | |
if (!Features::is_enabled('navigation')) { | |
add_menu_page( | |
__('Software Manager', WC_SOFTWARE_MANAGER_TEXT_DOMAIN), | |
__('Software Manager', WC_SOFTWARE_MANAGER_TEXT_DOMAIN), | |
'manage_woocommerce', | |
'woocommerce-software-manager', | |
null, | |
'dashicons-album', | |
56 | |
); | |
} | |
PageController::get_instance()->connect_page([ | |
'id' => 'woocommerce-software-manager', | |
'title' => 'Software Manager', | |
'capability' => 'manage_woocommerce', | |
'path' => 'wc-admin&path=/software-manager', | |
]); | |
}, 6); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment