A WordPress-centric search engine for devs and theme authors



post_class ›

Since2.7.0
Deprecatedn/a
post_class ( $class = '', $post_id = null )
Parameters: (2)
  • (string|array) $class One or more classes to add to the class list.
    Required: No
    Default: (empty)
  • (int|WP_Post) $post_id Optional. Post ID or post object. Defaults to the global `$post`.
    Required: No
    Default: null
Defined at:
Codex:

Display the classes for the post div.



Source

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 ) ) . '"';
}