lundi 29 décembre 2014

WP Plugins - Use includes to display page content


So I have a plugin I have been working on. It adds a menu and multiple submenus.


Each submenu page contains a form, this form is created in a function called add_content_submenupagename. This function is used on the end of an add_submenu hook.


My question is, instead of having a tonne of similar form code in my main PHP file can I add in in seperate files then use these files as the content for each submenu page? I think this would be a cleaner solution then what I currently have.


Additionally I am using PHP to deal with the form once its submitted. As I now have multiple forms that need to be handled differently could this also be put into an includes file?


My aim is to make my plugin as easily maintainable as possible and having one huge file probably isn't the best approach.


Thanks in advance.





Aucun commentaire:

Enregistrer un commentaire