Glossary Term
get_post_class()
get_post_class() — Retrieves an array of the class names for the post container element. The class names are many: If the post has a post thumbnail, has-post-thumbnail is added as a class. If the post is sticky, then the sticky class name is added. The class hentry is always added to each post. For each taxonomy that the post belongs to, a class will be added of the format {$taxonomy}-{$slug}, e.g. 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, {
Inputs: $css_class (string|string[]): Optional. Space-separated string or array of class names to add to the class list. Default empty. $post (int|WP_Post|null): Optional. Post ID or post object.
Returns string[]: Array of class names.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
