Uses
Uses | Description |
---|---|
wp-includes/formatting.php: esc_attr() | Escaping for HTML attributes. |
wp-includes/post-template.php: get_post_class() | Retrieves an array of the class names for the post container element. |
Displays the classes for the post container element.
(string|array) (Optional) One or more classes to add to the class list.
Default value: ''
(int|WP_Post) (Optional) Post ID or post object. Defaults to the global $post
.
Default value: null
File: wp-includes/post-template.php
function post_class( $class = '', $post_id = null ) { // Separates classes with a single space, collates classes for post DIV. echo 'class="' . esc_attr( join( ' ', get_post_class( $class, $post_id ) ) ) . '"'; }
Version | Description |
---|---|
2.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/post_class