i am new to wordpress so you can except a lot insane coding below. What i want is to give one option in the adminpanel of wordpress to my client under the Pages->MergeImage. when the client will click on MergeImage option appearing under the Pages Widget i want to display him my custom form . To achieve all the above i followed the codex and ended up creating a plugin. below is the code for my plugin.
add_action('admin_menu', 'my_plugin_menu');
function my_plugin_menu() {
add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options');
}
function my_plugin_options() {
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
echo '<div class="wrap">';
echo '<p>Here is where the form would go if I actually had options.</p>';
echo '</div>';
}
There is nothing else in this single index.php file inside the ImageMerger folder.
When i activate the plugin i receive no errors but also dont see any menu. The below code is copy paste from the codex. So there shouldn’t be any thing wrong with the code i think it must be some thing to add more into it which i am missing and i didn’t find any good tutorial on wordpress to achieve this task. Please tell me what else is required ?
You are using
add_options_page()
so this means that you are adding a page menu item under settings section of your WP admin menu. By the sounds of it you dont want to add your page there but you really want it to appear as a sub page of thepages
menu. Am I correct in this assumption?If that’s the case you need to look at using
add_submenu_page('edit.php?post_type=page',...)
instead. See codex article add_submenu_page()Also where are you placing the above code? In a plugin file or inside your themes functions.php file?
add_options_page()
places the menu item under the Settings menu. I believe you’ll find your plugin menu there if you look.If you want it under the Pages menu, you have to use
add_submenu_page()
:Note there is an extra argument at the beginning to pass the parent menu slug.