difference between add_object_page and add_menu_page
It’s just a wrapper for add_menu_page() with one addition: It adds the menu page as absolutely last/to the bottom of the menu.
It’s just a wrapper for add_menu_page() with one addition: It adds the menu page as absolutely last/to the bottom of the menu.
As you can’t suppose to get a full working example without any given code, I’ll show you a rough wordpress AJAX setup: Put all this in functions.php: <?php add_action(‘wp_head’, ‘my_action_javascript’); function my_action_javascript() { ?> <script type=”text/javascript” > jQuery(document).ready(function($) { jQuery.ajax( type: ‘POST’, url: <?php echo admin_url(‘admin-ajax.php’); ?>, data: { action : ‘your_AJAX_call’, league : $(‘input#league’).val() … Read more
The probability is high that no hook will exist for that… But it can be solved with jQuery: add_action( ‘admin_head-post.php’, ‘wpse_58567_highlight_menu_item’ ); function wpse_58567_highlight_menu_item() { global $post; if( 69 != $post->ID ) return; ?> <script type=”text/javascript”> jQuery(document).ready( function($) { $(‘#toplevel_page_post-post-69-action-edit’).removeClass(‘wp-not-current-submenu’).addClass(‘current’); $(‘#toplevel_page_post-post-69-action-edit’).find(‘a:last’).addClass(‘current’); }); </script> <?php }
Interesting exercise, a one page plugin that believes it deserves a first level menu page is wrong, IMO. I use the same technique with Jetpack. To create sub-pages in the Options Page add-on, read the documentation. The logic of this menu/sub-menu swapping is: Add multiple ACF Options Pages Create our menu first level page Remove … Read more
I was able to track this down to the culprit function add_theme_page(). There There was an additional parameter, per the codex for add_theme_page() that needed to be removed. Removing that seemed to help. function fivehundred_register_admin_menu() { add_theme_page( ‘500 Settings’, ‘500 Settings’, ‘manage_options’, ‘theme-settings’, ‘fivehundred_admin_menu’, plugins_url( ‘/ignitiondeck/images/ignitiondeck-menu.png’ ) ); } add_action( ‘admin_menu’, ‘fivehundred_register_admin_menu’ ); Fixed code … Read more
I hate OOP mixed in the functional structure of wordpress (here come the downvotes…..). If you use OOP just for name spacing then just use the name spacing feature of PHP, putting function in a class is just a very small part of what OOP should be. Anyway, your problems is that a there are … Read more
Ok my bad found the answer on the codex page but at the very bottom so I’m adding this here as well so if anyone like my didn’t catch it on WordPress’s codex, they can find it here 🙂 Just use get_admin_page_title(); See the example 1 below: function register_my_custom_submenu_page() { add_submenu_page( ‘tools.php’, ‘My Custom Submenu … Read more
add_menu_page(); as far as I can tell does not work with screen_icon or the default CSS parameters. The $icon paramater only takes 2 options, an url or div (well 3 if you leave it empty), so that leaves you with these options: Hard-code the link to the icons which are located in wp-includes/images/wpicons.png. This is … Read more
There is a workaround to hide this automatically created submenu. In the past I’ve used it quite often, but lately I have returned to leaving it as is (or renaming it, as m0r7if3r suggested). Also note, that aside your main question, you have switched the positions of the menu_slug and function arguments in add_menu_page, see … Read more
Make sure that your add_action hook is set to admin_menu. Here’s a sample code: add_action(‘admin_menu’, ‘wpse149688’); function wpse149688(){ add_menu_page( ‘Wholesale Pricing’, ‘Wholesale’, ‘manage_options’, ‘woo-wholesale’, ‘woo_wholesale_page_call’); add_submenu_page( ‘woo-wholesale’, ‘Registrations’, ‘Registrations’, ‘manage_options’, ‘woo-wholesale-registrations’, ‘wwpr_page_call’ ); } Also check whether user you’ve logged in as has the ability to view this menu. As this menu is set using … Read more