• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / post_class() – Displays the classes for the post container element.

You appear to be a bot. Output may be restricted

Description

Displays the classes for the post container element.

Usage

post_class( $class, $post_id );

Parameters

$class
( string|array ) optional – One or more classes to add to the class list.
$post_id
( int|WP_Post ) optional – Optional. Post ID or post object. Defaults to the global `$post`.

Returns

void

Source

File name: wordpress/wp-includes/post-template.php


Lines:

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

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 9th December 2020

Primary Sidebar

Information

Function name: post_class
Plugin ref: WordPress
Version: 5.6.2
Sourcefile: wp-includes/post-template.php
File ref: wp-includes/post-template.php
Deprecated?: No
API Letters: C,P

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6.2
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites