Change the menu location
-
Hi.
I want to change demo menu location theme.php to custom menu.
So I changed ‘parent_slug’ which is themes.php to my-custom-menu.
The menu change to my custom menu but it is not working.
When I click the demo menu at my custom menu, link to 404 page.
I want to know, what shoud I do.Help~
thank you….
-
Hi,
did you follow the instructions in the FAQ: https://wordpress.org/plugins/one-click-demo-import/#faq for the question “How to change the location, title and other parameters of the plugin page?” ?
Take care!
Hi,
I tried that already but it is not working…..
My codes are..
****************************************************************** function ocdi_plugin_page_setup( $default_settings ) { $default_settings['parent_slug'] = 'mytheme-builder-demo'; $default_settings['page_title'] = esc_html__( 'Demo Import' , 'sonnet' ); $default_settings['menu_title'] = esc_html__( 'Import Demo Data' , 'sonnet' ); $default_settings['capability'] = 'manage_options'; // $default_settings['menu_slug'] = 'admin.php?page=theme-sonnet-demo-import'; $default_settings['menu_slug'] = 'theme-sonnet-demo-import'; return $default_settings; } add_filter( 'pt-ocdi/plugin_page_setup', 'ocdi_plugin_page_setup' ); *************************************************************************I need your help….
I look forward to your reply.
Thank you.
-
This reply was modified 8 years ago by
Jan Dembowski.
Hi,
I think the
parent_slugparameter has to be one of the main WP menu sections. Please look at this comment: https://developer.wordpress.org/reference/functions/add_submenu_page/#user-contributed-notesTake care!
Hi,
Thank you for your reply.
but I have still problem.Do you know how can add demo import at custom menu page which is I made it?
when I make menu page, the menu page url is ~admin.php.
I wana to konw how demo importer add the admin.php.
I need your help….
I look forward to your reply.
Thank you.
Hi,
can you please show me the code you used to create the new top level custom wp-admin menu item?
Take care!
Hi,
Here is my code…
////////// menu-resister.php ///////////// function welcome_screen() { require_once 'admin-screens/welcome-test.php'; } function sub_screen() { require_once 'admin-screens/sub-test-2.php'; } add_action( 'admin_menu', 'sonnet_options_menu'); function sonnet_options_menu(){ add_menu_page ( 'Welcome', 'MY CUSTOM THEME', 'switch_themes', 'custom-builder-demo', '', '', '2.111111' ); add_submenu_page( 'custom-builder-demo', esc_attr__('Welcome', 'shin'), esc_attr__('Welcome', 'shin'), 'edit_theme_options', 'custom-builder-demo', 'welcome_screen' ); add_submenu_page( 'custom-builder-demo', esc_attr__('sub 2', 'shin'), esc_attr__('sub 2', 'shin'), 'manage_options', 'sonnet-sub2', 'sub_screen' ); } //////////////////////////////////////////////////// ////////// demo-import.php ///////////// function ocdi_plugin_page_setup( $settings ) { $settings['parent_slug'] = 'custom-builder-demo'; $settings['page_title'] = esc_html__( 'Demo Import' , 'pt-ocdi' ); $settings['menu_title'] = esc_html__( 'Import Demo Data' , 'pt-ocdi' ); $settings['capability'] = 'edit_theme_options'; $settings['menu_slug'] = 'custom-one-click-demo-import'; return $settings; } add_filter( 'pt-ocdi/plugin_page_setup', 'ocdi_plugin_page_setup' ); //////////////////////////////////////////////////////////I made 2 php files and the codes are up there…..
Please Help…
I look foward to your reply.
Thank you….
-
This reply was modified 8 years ago by
Jan Dembowski.
Please wrap your code using the
codebutton. If you don’t then all you are sharing is an unreadable mess.///////// menu-resister.php ///////////// function welcome_screen() { require_once 'admin-screens/welcome-test.php'; } function sub_screen() { require_once 'admin-screens/sub-test-2.php'; } add_action( 'admin_menu', 'sonnet_options_menu'); function sonnet_options_menu(){ add_menu_page ( 'Welcome', 'MY CUSTOM THEME', 'switch_themes', 'custom-builder-demo', '', '', '2.111111' ); add_submenu_page( 'custom-builder-demo', esc_attr__('Welcome', 'shin'), esc_attr__('Welcome', 'shin'), 'edit_theme_options', 'custom-builder-demo', 'welcome_screen' ); add_submenu_page( 'custom-builder-demo', esc_attr__('sub 2', 'shin'), esc_attr__('sub 2', 'shin'), 'manage_options', 'sonnet-sub2', 'sub_screen' ); }////////// demo-import.php ///////////// function ocdi_plugin_page_setup( $settings ) { $settings['parent_slug'] = 'custom-builder-demo'; $settings['page_title'] = esc_html__( 'Demo Import' , 'pt-ocdi' ); $settings['menu_title'] = esc_html__( 'Import Demo Data' , 'pt-ocdi' ); $settings['capability'] = 'edit_theme_options'; $settings['menu_slug'] = 'custom-one-click-demo-import'; return $settings; } add_filter( 'pt-ocdi/plugin_page_setup', 'ocdi_plugin_page_setup' );I made 2 php files and the codes are up there…..
Please Help…
I look foward to your reply.
Thank you….
Hi,
the issue in your case was that the OCDI plugin
add_submenu_pagecall was triggered before your custom wp-admin page was even created.You can solve that, but setting the priority for this line:
add_action( 'admin_menu', 'sonnet_options_menu');change it to:
add_action( 'admin_menu', 'sonnet_options_menu', 9);Take care!
Hi,
Thank you!
It is working now~!Thank you~~~!
No problem.
Have a nice day!
-
This reply was modified 8 years ago by
The topic ‘Change the menu location’ is closed to new replies.