47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<?php
|
|
|
|
// If this file is called directly, abort.
|
|
if( !defined('ABSPATH'))
|
|
{
|
|
die('Nothing to see here...');
|
|
}
|
|
// Hook into 'admin_menu' action to add our custom menu page
|
|
add_action('admin_menu', 'out_of_office_for_woo_tools_submenu');
|
|
|
|
function out_of_office_for_woo_tools_submenu()
|
|
{
|
|
add_submenu_page(
|
|
'options-general.php', // Parent menu slug (Tools)
|
|
'Out of Office for Woo Settings Page', // Page title
|
|
'Out of Office for Woo', // Menu title
|
|
'manage_options', // Capability of the user to see this page
|
|
'out-of-office-for-woo', // Menu slug of the settings page
|
|
'out_of_office_for_woo_tools_submenu_page' // Function to display the page content
|
|
);
|
|
add_action('admin_init', 'out_of_office_for_woo_options_init');
|
|
}
|
|
|
|
|
|
// Function to output the content of our custom sub-menu page
|
|
function out_of_office_for_woo_tools_submenu_page() {
|
|
//Double check user capabilities
|
|
if ( !current_user_can('manage_options') ) {
|
|
return;
|
|
}
|
|
include( OOOWOO_DIR . 'templates/admin/settings-page.php');
|
|
}
|
|
|
|
|
|
// Add a link to your settings page in your plugin
|
|
function out_of_office_for_woo_add_settings_link( $links ) {
|
|
|
|
$url = get_admin_url( ) . "options-general.php?page=out-of-office-for-woo";
|
|
$settings_link = '<a href="' . $url . '">' . __('Settings', 'out-of-office-for-woo') . '</a>';
|
|
$links[] = $settings_link;
|
|
// $settings_link = '<a href="options-general.php?page=out-of-office-for-woo">' . __( 'Settings','out-of-office-for-woo' ) . '</a>';
|
|
// array_push( $links, $settings_link );
|
|
return $links;
|
|
}
|
|
$filter_name = "plugin_action_links_" . OOOWOO_BASENAME;
|
|
add_filter( $filter_name, 'out_of_office_for_woo_add_settings_link' );
|