sticky_class()WP 2.7.0

Deprecated since 3.5.0. It is no longer supported and may be removed in future releases. Use post_class() instead.

Outputs the CSS class "sticky" for the post if it is marked as a sticky post.

This tag should be used inside the WordPress Loop.

No Hooks.

Returns

null.

Usage

<?php sticky_class(); ?>

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 7.0

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