post_class()
post_class( string|array $class = ”, int|WP_Post $post_id = null )
显示post container元素的类。
Displays the classes for the post container element.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$class | (string | array) | 可选 | 要添加到类列表中的一个或多个类。 |
$post_id | (int | WP_Post) | 可选 | Post ID或Post对象。默认为全局$post。 |
返回(Return)
无返回值
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.7.0 | wp-includes/post-template.php:455 | 0 | 1 function |
笔记(Notes)
添加更多类。
要打印当前文章以外的文章的文章类CSS类,请指定其ID(整数):
将多个类添加到post_类默认值的一个简单方法是将它们作为字符串参数写入:
post_class() 为WP2原创文章,链接:https://www.wp2.cn/functions/post_class/