Example 1 — Add a Featured label
Mark sticky posts in the loop.
<?php if ( is_sticky() ) : ?>
<span class="badge">Featured</span>
<?php endif; ?>
<h2><?php the_title(); ?></h2> How It Works
is_sticky()checks the current post in the loop.- The badge is printed only for sticky posts.
- The title is printed for every post.

