New answers tagged

0

I improve the solution of @brasofilo as it is have small bug - on page reload with not best internet connection menu will appear for very short time. To avoid it I added a bit of more css: add_action('admin_head', 'wpse_52099_script_enqueuer'); function wpse_52099_script_enqueuer() { if(!current_user_can('administrator')) { echo <<<HTML ...


1

I believe you're looking for the network_admin_menu hook. The Codex page for network_admin_menu has the following example: add_action('network_admin_menu', 'function_name'); function function_name() { add_menu_page( "page_title", "menu_title", 'capability', 'menu_slug', 'function_callback' ); }


0

I see two options here - override the CSS, or remove the "active" classes with JavaScript (sadly there is no action/filter that we can do this server-side) - I opted for the JS approach, it's cleaner, leaner and meaner: function wpse_227037_remove_menu_classes() { echo '<script>jQuery( ".wp-has-current-submenu.wp-menu-open" ).removeClass( ...


2

No, it is not possible to create third level menu in admin panel. If you look at the definition of add_submenu_page, you need to mention the parent slug name. For eg: add_menu_page ( 'Test Menu', 'Test Menu', 'read', 'testmainmenu', '', '' ); add_submenu_page ( 'testmainmenu', 'Test Menu', 'Child1', 'read', 'child1', ''); The first parameter of the ...


2

Try this one http://jsfiddle.net/jaredwilli/tZPg4/4/ and use array so input should be something like this <input type="text" name="data[1][time][start]"> <input type="text" name="data[1][time][end]"> <input type="text" name="data[2][time][start]"> <input type="text" name="data[2][time][end]"> .... then save data as array ...


0

You can not load external file in this way. This argument is for menu slug. If you load the external file it is useless, there will be nothing just except what you will print in file also there will be no WordPress functions at all (because WordPress is not loaded). You can define a callback function for this then include your red.php in that function. ...


0

pre_get_users is the action that is fired before a user query is run. You need to check the context of the action to make sure you're on the main users screen. You can then alter the query with any parameters accepted by WP_User_Query. A quick example: function wpd_filter_users( $query ) { $screen = get_current_screen(); if( is_admin() && ...


0

Plugins generate menu items by calling add_management_page(). Here they insert the slug that ends up in the menu. Usually this slug is the same as the plugin slug, but this is not mandatory. Hence your partial result when you tried this. You would have to scavenge all plugin files to find the slugs as @Mark Kaplun suggested. Or you could override ...



Top 50 recent answers are included