sticky_class()WP 2.7.0

Deprecated from version 3.5.0. It is no longer supported and can be removed in future releases. Use post_class() instead.

Display "sticky" CSS class, if a post is sticky.

No Hooks.

Return

null. Nothing (null).

Usage

sticky_class( $post_id );
$post_id(int)
An optional post ID.
Default: null

Examples

0

#1 Demo

<div class="post <?php sticky_class() ?>" id="post-<?php the_ID() ?>">

We get:

<div class="post sticky" id="post-123">

Notes

Changelog

Since 2.7.0 Introduced.
Deprecated since 3.5.0 Use post_class()

sticky_class() code WP 6.5.2

function sticky_class( $post_id = null ) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
	if ( is_sticky( $post_id ) )
		echo ' sticky';
}