use_default_gallery_style
云策文档标注
概述
use_default_gallery_style 是一个 WordPress 过滤器,用于控制是否输出默认的图库样式。它根据主题是否支持 HTML5 图库来设置默认值。
关键要点
- 这是一个过滤器,参数为布尔值 $print,决定是否打印默认图库样式。
- 默认值取决于主题是否支持 HTML5 图库:如果支持,默认值为 false;否则为 true。
- 在 gallery_shortcode() 函数中调用,用于构建图库短码输出。
- 自 WordPress 3.1.0 版本引入。
原文内容
Filters whether to print default gallery styles.
Parameters
$printbool-
Whether to print default gallery styles.
Defaults to false if the theme supports HTML5 galleries.
Otherwise, defaults to true.
Source
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |