Is there any substantial difference between the Pluign options or Theme options for admin ?
I can find a lot of good theme related tutorials (for options pages) – but not so much (or not so clear) plugins option page .
Does following the themes related tutorials will be substantial the same ?
(considering only activation / deactivation hooks would be different ? )
Edit I – just to clarify:
my question was more specifically, whether I could follow the “themes” tutorials for the settings, even if I need it for “plugins” – and if so, what exactly are the points which I would need to change / pay attention to ..
This weekend I wrote my first plugin after being a WP theme developer since 2007 and I was confronted with the same problems as you.
It turns out that the theme page basically just a simplified version of what you would do to create a plugin page. This often means that functions take lesser arguments and you have less to think about. But it’s a double-edged sword since it gives you less freedom about what you wanna do.
E.g: Instead of
add_theme_page()you would calladd_menu_page()oradd_submenu_page()depending on where you want your menu to appear. Comparing the arguments:Same goes for
add_options_page()wich is a wrapper functionadd_submenu_page().The second thing I noticed is the Settings API. As long as you follow the Codex you and your plugin are save since it takes away all of the actual settings form layout creation. This is what many tutorials out there spend their most energy in: creating hundreds of lines of code to layout forms. Settings API is kind of like a framework for that.
I checked all top google tutorial results for “wordpress theme options page” and only two of them used the Settings API (this and that one). So I recommend you do not follow most of the tutorials unless they use the Settings API.
That’s it really. Creating a plugin settings in WordPress is nothing more than registering the menu item and rendering the settings via Settings API.