2017-07-28 19:31
浏览 54


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?

图片转代码服务由CSDN问答提供 功能建议

在html中开发wordpress设置页面是否有问题? 当我搜索互联网和github时,我发现(几乎 教程如何在OOP中构建设置页面。

我有一本书'Wordpress插件开发' https://www.amazon.com/Professional-WordPress-Plugin-Development-Williams/dp/0470916222 但有点过时(2011年打印)我不喜欢 不知道某些功能是否被删除。

我还有“Pro Wordpress设计与开发”一书,于2015年打印。 在上一本书中,他们构建了一个不在OOP中的设置页面 ,但是用html构建。

使用html而不是在OOP中构建设置页面是否有问题? 这是否适合未来发展?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

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.

    解决 无用
    打赏 举报
  • doulongti5932 2017-07-28 19:42

    In the body of your question, you are talking about two different things... html is a client side language where as OOP stands for Object-Oriented Programming --- which is a programming paradigm and has it's applications in languages such as Java, Python, Ruby, etc.

    PHP on the other hand, allows one to program either procedurally or OOP

    So the question is not which to pick... it's whatever style you are comfortable with (I recommend going the OOP route).

    Lastly, which ever you pick, you will be writing HTML for things like radio buttons, input boxes, etc. on the settings view. And speaking of views, if you go the MVC route (which stands for Model-View-Controller---which is an architectural pattern---your HTML will be inside the View

    解决 无用
    打赏 举报
  • dongque1958 2017-07-28 19:43

    It will be best , if you will go to build WP plugin through OOPS . Because you don’t really have to worry about clashing with functions defined elsewhere .

    解决 无用
    打赏 举报

相关推荐 更多相似问题