Example 1 — Make a unique ID
Give each post a unique id attribute.
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
</article>
<?php endwhile; ?> How It Works
the_ID()prints the ID of the current post.- Each post gets a different
id. - You can now link to
#post-12or style it.

