How do I hide the menus below from wordpress admin menu except for Admin:
admin.php?page=booki/index.php
admin.php?page=booki/managegcal.php
admin.php?page=booki/userhistory.php
admin.php?page=booki/cancelledbookings.php
admin.php?page=booki/reminders.php
admin.php?page=booki/stats.php
I tried this for first one but not worked:
add_action( 'admin_menu', 'nstrm_remove_admin_submenus', 999 );
function nstrm_remove_admin_submenus() {
remove_submenu_page( 'admin.php', 'booki/index.php' );
}
This menus are made by wordpress Booki plugin:
www.booki.io
I checked the plugin demo and the first admin menu on your list is the main/top admin menu page, so if you remove it the whole menu will disappear.
If you really want to remove the whole menu, this should work:
add_action('admin_menu', 'so_40959455_admin_menu', 999);
function so_40959455_admin_menu() {
remove_menu_page('booki/index.php');
}
If you just want to remove the other submenus, this should work:
add_action('admin_menu', 'so_40959455_admin_menu', 999);
function so_40959455_admin_menu() {
remove_submenu_page('booki/index.php', 'booki/managegcal.php');
remove_submenu_page('booki/index.php', 'booki/userhistory.php');
remove_submenu_page('booki/index.php', 'booki/cancelledbookings.php');
remove_submenu_page('booki/index.php', 'booki/reminders.php');
remove_submenu_page('booki/index.php', 'booki/stats.php');
}
Related
The Breadcrumbs in WooCommerce 3 is :
Home > Shop > Product Cats... > Product name
So, how can I remove the "Shop" word from Breadcrumbs ?
This is how I am doing something similar
add_filter( 'woocommerce_get_breadcrumb', array($this, 'rewriteBreadcrumb') );
public function rewriteBreadcrumb($crumbs) {
global $post;
$breadcrumbSize = sizeof($crumbs);
// You can edit the breadcrumb array here
if( $breadcrumbSize > 1 ) {
$crumbs[$breadcrumbSize-1][0] = $customCrumbName;
}
return $crumbs;
}
Looks like you can use this plugin...
Woocommerce Permalinks Manager
... to remove "Shop" from the slug.
I am using woocommerce and I add the one menu My Account using woocommerce plugin But I want to show the menu login and logout instead of My Account which I add the into menu. I also added the script into functions.php result is same.
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'primary_navigation') {
//echo "hello friend how are";
$items .= '<li>Log Out</li>';
}
elseif (!is_user_logged_in() && $args->theme_location == 'primary_navigation') {
$items .= '<li>Log In</li>';
}
return $items;
}
When I am using jupitor theme and when I see the theme location of My Account Menu I get
Primary Navigation
I have a one doubt is I have to add the My Account menu first then I add the login and logout menu.
Your above code will add login/logout links to menu. You do not have to add My Account menu.
Please check your theme_location. If theme location is correct then login/logout link will add to menu.
For check theme_location you have to search register_nav_menus in functions.php file of your theme. If you find it in functions.php file then you can see theme_location inside register_nav_menus code.
I have the following function which creates the menus in the admin area for my plugin.
function register_menu_items() {
add_menu_page(null, 'Ebay Motors', 'manage_options', 'ebay-motors-admin', array($this, 'ebay_motors_admin'));
add_submenu_page( 'ebay-motors-admin', 'Upload XML', 'Upload XML', 'manage_options', 'upload-xml', array($this, 'upload_xml'));
add_submenu_page( 'ebay-motors-admin', 'Archive XML', 'Archive XML', 'manage_options', 'archive_xml', array($this, 'archive_xml'));
}
This works, however (expectedly) the main menu item also creates a sub-menu item. Is there a way to create the main menu item without intern creating a submenu item. I'd also like the Main Menu item to link straight to the upload_xml function.
You can set the slug of your sub menu to be the same of the main menu item. This way you can overwrite the first menu item.
I'm adding a plugin menu (this gets added correctly) and a submenu under it (this never shows up) like this:
//We'll call the action to add the menu when the plugin is loaded
add_action( "plugins_loaded", "load" );
function load()
{
//Add us to the menu
add_action( "admin_menu", "addToMenu" );
}
function addToMenu()
{
//Main menu
add_plugins_page( "My Plugin", "My Plugin", "administrator", "my-plugin", "handlePlugin" );
//Sub Menu
add_submenu_page( "my-plugin", "test", "test", "administrator", "my-sub-slug", "handleSub" );
}
The above adds the "My Plugin" but not the "test" submenu. What am I doing wrong?
Wordpress does not allow 3rd level menu items by default. Code would be needed to alter how the Wordpress menu works to allow this. The workaround is to put your item not under plugins but at the top level.
Is it possible to add a new admin menu to the woocommerce admin section in Wordpress?
I've done this with WP E-commerce with my custom plugin so am wandering if the same is true for Woo commerce.
Thanks
Well, if you use something like this:
add_action('admin_menu', 'register_my_custom_submenu_page');
function register_my_custom_submenu_page() {
add_submenu_page( 'woocommerce', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' );
}
function my_custom_submenu_page_callback() {
echo '<h3>My Custom Submenu Page</h3>';
}
Then you will see a submenu under "Woocommerce" admin menu. For some reason you can´t do same using post_type=shop_order.
"shop_order" is the one you should use to put a submenu under "Woocommerce" one.. but, as i said, don´t know why didn´t work with that particual post_type.
http://codex.wordpress.org/Function_Reference/add_submenu_page
For me the following worked:
add_submenu_page(
'edit.php?post_type=product',
PAGE_TITLE,
MENU_TITLE,
'manage_woocommerce',
'custom_wc_menu'
);
Setting the $parent_slug to edit.php?post_type=product