post_class() WP 1.0
Display the classes for the post div.
Works based on: get_post_class()
1 time = 0.004188s = very slow | 50000 times = 10.89s = slow | PHP 7.0.2, WP 4.4.1
No Hooks.
Return
Null. Nothing.
Usage
post_class( $class, $post_id );
- $class(string/array)
- One or more classes to add to the class list.
Default: '' - $post_id(int/WP_Post)
- Post ID or post object.
Default: global $post
Changelog
Since 2.7.0 | Introduced. |
Code of post_class() post class WP 5.6
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 ) ) ) . '"';
}Related Functions
From tag: Decor (design, layout, styling, class)
More from category: Other Theme Functions
- add_theme_support()
- bloginfo()
- current_theme_supports()
- get_custom_header_markup()
- get_custom_logo()
- get_header_image()
- get_header_image_tag()
- get_header_textcolor()
- get_header_video_url()
- get_page_templates()
- get_post_class()
- get_query_template()
- get_stylesheet()
- get_template()
- get_theme_mod()
- get_theme_mods()
- get_theme_root()
- has_custom_logo()
- has_header_image()
- has_header_video()
- is_child_theme()
- is_header_video_active()
- is_multi_author()
- register_nav_menu()
- register_nav_menus()
- register_theme_directory()
- remove_theme_mod()
- remove_theme_mods()
- remove_theme_support()
- search_theme_directories()
- set_theme_mod()
- single_month_title()
- the_custom_header_markup()
- the_custom_logo()
More from Template Tags: Posts, Pages, ...
- get_post_format()
- get_post_time()
- get_the_date()
- have_posts()
- in_the_loop()
- next_image_link()
- next_post_link()
- next_posts_link()
- post_password_required()
- posts_nav_link()
- previous_image_link()