WordPress开发者和主题制作者的搜索引擎



post_class ›

Since2.7.0
已弃用n/a
post_class ( $class = '', $post_id = null )
参数: (2)
  • (string|array) $class One or more classes to add to the class list.
    Required: No
    默认: (empty)
  • (int|WP_Post) $post_id Optional. Post ID or post object. Defaults to the global `$post`.
    Required: No
    默认: null
定义在:
文档:

Displays the classes for the post container element.



源码

function post_class( $class = '', $post_id = null ) {
	// Separates classes with a single space, collates classes for post DIV
	echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
}