Initial Commit: first running version of the plugin
This commit is contained in:
42
includes/woo-out-of-office-menu.php
Normal file
42
includes/woo-out-of-office-menu.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// Hook into 'admin_menu' action to add our custom menu page
|
||||
add_action('admin_menu', 'woo_out_of_office_tools_submenu');
|
||||
|
||||
function woo_out_of_office_tools_submenu()
|
||||
{
|
||||
add_submenu_page(
|
||||
'options-general.php', // Parent menu slug (Tools)
|
||||
'Woo Out of Office Settings Page', // Page title
|
||||
'Woo Out of Office', // Menu title
|
||||
'manage_options', // Capability of the user to see this page
|
||||
'woo-out-of-office-page', // Menu slug of the settings page
|
||||
'woo_out_of_office_tools_submenu_page' // Function to display the page content
|
||||
);
|
||||
add_action('admin_init', 'woo_out_of_office_options_init');
|
||||
}
|
||||
|
||||
|
||||
// Function to output the content of our custom sub-menu page
|
||||
function woo_out_of_office_tools_submenu_page() {
|
||||
//Double check user capabilities
|
||||
if ( !current_user_can('manage_options') ) {
|
||||
return;
|
||||
}
|
||||
//echo("test");
|
||||
//echo(plugin_basename( __FILE__ ));
|
||||
include( WOOO_DIR . 'templates/admin/settings-page.php');
|
||||
}
|
||||
|
||||
|
||||
// Add a link to your settings page in your plugin
|
||||
function woo_out_of_office_add_settings_link( $links ) {
|
||||
|
||||
$url = get_admin_url( ) . "options-general.php?page=woo-out-of-office-page";
|
||||
$settings_link = '<a href="' . $url . '">' . __('Settings', 'woo-out-of-office-page') . '</a>';
|
||||
$links[] = $settings_link;
|
||||
// $settings_link = '<a href="options-general.php?page=woo-out-of-office-page">' . __( 'Settings','woo-out-of-office-page' ) . '</a>';
|
||||
// array_push( $links, $settings_link );
|
||||
return $links;
|
||||
}
|
||||
$filter_name = "plugin_action_links_" . WOOO_BASENAME;
|
||||
add_filter( $filter_name, 'woo_out_of_office_add_settings_link' );
|
||||
Reference in New Issue
Block a user