作为一个灵活的主题,它应该能够自定义代码和集成第三方服务。因此,我们带来了一个叫做钩子的特性。

在本文中,我们将介绍所有钩子并提供一些用例。

总览

钩子 描述
head-end <head> 结束之前
body-begin <body> 开始处
body-end <body> 结束之前
main-begin <main> 上方
main-end <main> 下方
list-begin 文章列表上方
list-end 文章列表下方
sidebar-begin 侧边栏上方
sidebar-end 侧边栏下方
content-begin 文章内容上方
content-end 文章内容下方
comments-begin 评论上方
comments-end 评论下方
footer-begin footer 上方
footer-end footer 下方
post-panel-begin 文章工具栏上方
post-panel-end 文章工具栏下方
docs/sidebar-begin 文档侧边栏上方
docs/sidebar-end 文档侧边栏下方
docs/nav-begin 文档导航上方
docs/nav-end 文档导航下方
contact/form-field-begin 表单字段上方
contact/form-field-end 表单字段下方
search/sidebar-begin At very top of the search sidebar
search/sidebar-end Before the search sidebar end

用法

使用钩子很容易,你需要做的是在 layouts/partials/hooks 目录中创建一个与钩子同名的 HTML 文件。

sidebar-begin 为例:

1echo '<section class="row card component text-center"><div class="card-body">SIDEBAR BEGIN</div></section>' \
2  > layouts/partials/hooks/sidebar-begin.html