duansha3771 2017-07-28 19:31
浏览 54
已采纳

开发Wordpress插件设置页面程序或OOP?

Is it a problem develop wordpress settings page in html? When i search the internet and github, i found (almost) tutorials how build a settings page in OOP.

I have a book 'Wordpress Plugin Development' https://www.amazon.com/Professional-WordPress-Plugin-Development-Williams/dp/0470916222 but is a bit outdated (print in 2011) and i don't know if some functions are depricated.

I have also the book 'Pro Wordpress Design and Development', print in 2015. In the last book they build a settings page NOT in OOP, but build in html.

Is it a problem building a settings-page with html and not in OOP? Is this future-proof?

  • 写回答

3条回答 默认 最新

  • doudao9915 2017-07-28 19:45
    关注

    If you are developing a Plugin, most places I have read recomend to go OOP, if you are developing a theme or for a theme, the recomendation is to go with pluiggable functions. This is functios wrapped in an if that determines if the function has already been defined, anybody can later on override you function, normally in the functions.php script.

    Now for plugins there are some skeletons or boilerplate that using oop separate admin functions from public functions, and also separate logic from presentation. And also put hooks all in the same place. You can search a bit on this a find one you feel confortable with.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?