After writing your plugin maybe you want to allow the users to costumize it. One way to do this is including an option page on the wordpress admin section.
To write a simple option page I’ll use the previews example Happy Face Replacer Plugin. And I’ll allow the user to set the happy face image url.
First of all you need to figure out where is the best place to include your administration page on the wordpress admin sections: Settings, Manage, Plugins, Presentation, Write, Users.
In this case I’ll use the “Manage” panel.
To tell wordpress about your option page you need to use an action ‘hook’ called admin_menu (on the previews post you can read more about wordpress actions, filters and hooks).
In our main plugin file “happy_face_replacer.php” we need to include something like this:
Inside of the ‘funtion to create your menu’ you need to use one of the ‘add_menu/submenu_page’ functions :
add_menu_page(page_title, menu_title, access_level/capability, file, [function]);
for the menus or:
add_submenu_page(parent, page_title, menu_title, access_level/capability, file, [function]);
for the submenus.
In this example we need to call the function:
As your plugin your admin menu, page and functions must have a unique name. Continue reading WordPress Plugin – Simple Option Page