WordPress Hooks 与 Includes?

发布于 2024-09-03 17:47:36 字数 145 浏览 2 评论 0原文

这在某种程度上是一个主观问题。

值得注意的主题,如 thematic 和 carrington 使用钩子来显示它们的主题。

试图找出最适合更高效工作流程的方法。

哪个在主题化方面似乎更有效?尝试权衡钩子与仅包含静态文件的优缺点。

This is somewhat a subjective question.

Noticed themes like thematic and carrington use hooks to display their themes.

Trying to figure out which works best for a more efficient workflow.

Which seems more efficient at theming? Trying to weigh in the cons and pros of hooks vs. just including static files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

汹涌人海 2024-09-10 17:47:36

无论如何,使用钩子。这更加高效,并且允许您的主题与也依赖于模板挂钩的各种小部件和加载项很好地配合。使用静态包含将使您的模板整体灵活性大大降低,并且在对 WordPress 后端进行更改时可能会出现损坏。

By all means, use the hooks. This is more efficient, and allows your theme to play nice with a variety of widgets and add-ins that also depend on the template hooks. Using static includes will make your template much less flexible overall, and opens you up to possible breakage as changes are made to the WordPress backend.

冷情妓 2024-09-10 17:47:36

如果您使用 Thesis,这个插件 WordPress › Thesis OpenHook « WordPress 插件 非常有用从钩子的角度来看,这很有趣,并且对于最终用户和开发人员来说,其他框架可以做些什么。

If you work with Thesis, this plugin WordPress › Thesis OpenHook « WordPress Plugins is very interesting from a hook standpoint and what could possibly be done with other frameworks for both end users and developers.

梦中楼上月下 2024-09-10 17:47:36

Hook 和 include() 实际上有两个完全不同的目的。包括静态地将附加内容引入您的主题,而挂钩允许插件和主题的functions.php动态添加内容。随着 WordPress 子主题的新增功能,挂钩还允许所述子主题向您的主题添加内容,而无需修改核心文件。

总而言之,这使您的主题更加面向未来,并且在考虑作为网站基础的主题框架时更容易推荐。

Hooks and include()s are really intended for two completely different purposes. Includes statically bring additional content into your theme, while hooks allow plugins and your theme's functions.php to add content on-the-fly. With the new-ish additions to WordPress of child themes, hooks also allow said children to add content to your theme without modifying the core files.

All-in-all, this makes your theme more future-proof and a much easier recommendation when it comes time to consider theme frameworks to base a site upon.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文