Settings page above CPT page in admin section

you can use the menu_order filter hook to change the order function custom_menu_order($menu_ord) { if (!$menu_ord) return true; return array(‘settings_page.php’, ‘edit.php?post_type=CTP1′,’edit.php?post_type=CTP2′,’edit.php?post_type=CTP3’); } add_filter(‘custom_menu_order’, ‘custom_menu_order’); add_filter(‘menu_order’, ‘custom_menu_order’);

Enqueueing Scripts on a Custom Top-level Menu Page

You could try replacing if( ‘nonpareil_theme_options’ != $hook ) with if( ‘toplevel_page_nonpareil_theme_options’ != $hook ) if you have the custom menu added like this: add_action(‘admin_menu’, ‘register_custom_menu_page’); function register_custom_menu_page() { add_menu_page(‘Nonpareil options’,’Nonpareil options’, ‘administrator’, ‘nonpareil_theme_options’, ‘nonpareil_theme_display’ ); } Edit: It looks like you are using this admin_enqueue_scripts example in the Codex: http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts#Example:_Target_a_Specific_Admin_Page so in your case … Read more

Admin Menus – Name Menu different from first Submenu [duplicate]

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; add_menu_page(‘Members’,’Members’,’manage_options’,’members’,’jp_handle_admin_members’); add_submenu_page(‘members’,’Membership Types’,’Membership Types’,’manage_options’,’membership_types’,’jp_handle_admin_membership_types’); $submenu[‘members’][0][0] = ‘All Members’; } That way your parent keeps the original … Read more

How to prevent parent admin page from appearring as a child admin page

Unless I misunderstand the question, this should do the trick: add_action(‘admin_menu’, ‘add_menu_pages’); function add_menu_pages() { add_menu_page(‘Menu Title’, ‘Menu Title’, 10, ‘main_menu’, ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 1’, ‘Sub Menu Title 1’, 10, ‘main_menu’ , ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 2’, ‘Sub Menu Title 2’, 10, ‘sub_menu’ , ‘submenu_2_callback’); } function submenu_1_callback() { echo “<h2>” . … Read more

Seriously stuck with some custom meta box/plugin stuff

Here is a simple example that adds a meta box to all public post types: // All public post types $post_types = array_merge( array(‘page’ => ‘page’, ‘post’ => ‘post’), get_post_types(array(‘_builtin’ => FALSE)), ); // Add meta box for each post type foreach ($post_types as $post_type) { add_meta_box(‘id’, ‘title’, ‘callback’, $post_type); } WP Codex: get_post_types(), add_meta_box().

Return value of add_menu_page

One important use is enqueue script / style only on specific plugin/admin pages. <?php add_action(‘init’, ‘my_plugin_admin_page’); function my_plugin_admin_page() { //create the menu page $hook = add_menu_page(….); //use the hook for this page for enqueuing add_action(‘admin_print_styles-‘ . $hook, ‘my_plugin_admin_styles’); } function my_plugin_admin_styles() { //enqueue the style/script here } ?> This is one use I know.

How to add a sub menu with AJAX?

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)