New answers tagged admin-menu
1
This is not an exact answer, but I think there are enough elements to build the desired output.
I sort the menu manipulating the global $menu, not really best practice, but for now it works.
The result of this example is moving Links Manager, Comments and Media Library to the end of the first block. The effect is: first all Post Types then these items.
We ...
2
I think you're using the wrong approach. Rather than removing the submenu item, alter how the post type was registered, and change the show_in_menu argument. Hook into init way late and change the argument.
<?php
add_action('init', 'wpse99123_post_type_switcher', 999);
function wpse99123_post_type_switcher()
{
global $wp_post_types;
...
1
D'oh.
I fixed it, but I'll leave this question in case others have similar problems.
When copy/pasting various options into wp-config.php I accidentally included this setting, which I don't normally use:
// Overkill but FYI: disallows installation/updating of any theme or plugin
define('DISALLOW_FILE_MODS',true);
That produces the described problem, ...
2
Add a javascript to all admin pages:
add_action( 'admin_print_scripts', 'auto_collapse_menu' );
function auto_collapse_menu(){
wp_enqueue_script( 'autocollapsemenu', plugins_url( 'autocollapsemenu.js', __FILE__ ), array( 'jquery' ), false, true );
}
The javascript:
jQuery(document).ready( function($){
// catch every click inside element with ...
3
The first menu item typically is the parent item and shares the name with that item, you can however manually update the entry directly in the $submenu variable, like so..
add_action( 'admin_menu', 'jp_create_admin_pages' );
function jp_create_admin_pages() {
global $submenu;
...
1
Have you tried changing the Menu title to 'All Membership Types'?
add_submenu_page(
'members',
'Membership Types',
'All Membership Types',
'manage_options',
'jp_handle_admin_membership_types');
http://codex.wordpress.org/Function_Reference/add_submenu_page
Not sure if it's possible to do it any other way.
I know ...
1
Programming and machines
As machines are "stupid", they need to be programmed. And programming languages don't work like languages spoken by humans as programs/machines as they can't interpret what the human thinks. They need a clear and unique advice what and when to something we order them. If you for e.g. define the function getBlock() twice, the machine ...
2
You can’t. Create a function that loads that file:
function load_admin_page_file()
{
require 'admin-members.php';
}
Then use that function name as callback argument.
In PHP 5.3 you can use a lambda:
add_menu_page(
'Members',
'Members',
'manage_options',
'members',
function() { require 'admin-members.php'; }
);
0
To see the the current array keys try this:
add_action( 'admin_menu' , 'admin_menu_new_items', 1 );
function admin_menu_new_items() {
global $submenu;
wp_die( '<pre>' . var_export( $submenu['edit.php'], true ) . '</pre>' );
}
I get this:
array (
5 =>
array (
0 => 'All Posts',
1 => 'edit_posts',
2 => ...
4
Wordpress SEO
If you want to remove the admin menu:
you can do that with:
function hide_wpseo() {
remove_action('admin_menu', 'zeo_options_menu');
}
add_action( 'init', 'hide_wpseo');
where it will be removed for all users.
WordPress SEO by Yoast
To hide the admin menu:
and the admin menu bar:
one can use:
function hide_yoastseo() {
...
0
Do you want to hide it for a specific kind of user like an author? If so, you can use the Advanced Access Manager plugin http://wordpress.org/extend/plugins/advanced-access-manager/
With this plugin you can decide what the user(group) has access to in the backend and also what permissions he/she has.
-1
You can try to insert css menu widgets with submenu on it.You can download some decent widgets
from
http://freebietemplate.com/css_designs/css_designs.html
2
You can check out this excellent answer by @Eugene Manuilov. In your case the relevant admin page action is:
load-appearance_page_customstyle
and the url to the custom stylesheet you want to edit:
get_admin_url().'theme-editor.php?file=custom-stylesheet.css&theme='. get_stylesheet().'&scrollto=0';
Then your code example would be:
...
1
From the documentation:
$function
(callback) (optional) The function to be called to output the content for this page.
In other words, this is the function that will be responsible for outputting content on your submenu page. You need to create it, give it a nice unique name, and then specify this name as the last argument into add_submenu_page:
...
1
The HTML
echo '<div id="screen-meta-links">';
echo ' <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">';
echo ' <a href="#" id="your-own-button" class="show-settings">Text for your button</a>';
echo ' </div>';
echo '</div>';
echo '<br style="clera:both" />';
echo '<div ...
1
Not sure why this question was dismissed so quickly. It's actually a valid question, and would be really useful to be able to add a button up there, or even edit the content of each screen option.
I know this is an old question, but...
If you want it to just add a button up there that would link somewhere else. You could just add some jQuery to add the ...
Top 50 recent answers are included
