_block_template_viewport_meta_tag()
云策文档标注
概述
_block_template_viewport_meta_tag() 函数用于渲染一个 'viewport' meta 标签,通过 Hook 到 wp_head 以从默认模板画布中解耦其输出。
关键要点
- 函数 _block_template_viewport_meta_tag() 输出一个 viewport meta 标签,用于响应式设计。
- 该函数通过 wp_head Hook 调用,确保其输出独立于默认模板画布。
- 自 WordPress 5.8.0 版本引入此函数。
代码示例
function _block_template_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "n";
}
原文内容
Renders a ‘viewport’ meta tag.
Description
This is hooked into ‘wp_head’ to decouple its output from the default template canvas.
Source
function _block_template_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "n";
}
Changelog
| Version | Description |
|---|---|
| 5.8.0 | Introduced. |