2020-05-01 / 3529阅 / 悠然
Retrieves an array of the class names for the post container element.
The class names are many. If the post is a sticky, then the ‘sticky’ class name. The class ‘hentry’ is always added to each post. If the post has a post thumbnail, ‘has-post-thumbnail’ is added as a class. For each taxonomy that the post belongs to, a class will be added of the format ‘{$taxonomy}-{$slug}’ – eg ‘category-foo’ or ‘my_custom_taxonomy-bar’.
The ‘post_tag’ taxonomy is a special case; the class has the ‘tag-‘ prefix instead of ‘post_tag-‘. All class names are passed through the filter, ‘post_class’, with the list of class names, followed by $class parameter value, with the post ID as the last parameter.
(string|string[])
(Optional)
Space-separated string or array of class names to add to the class list.
Default value: ''
(int|WP_Post)
(Optional)
Post ID or post object.
Default value: null
(string[]) Array of class names.