One question I get asked a lot is how I added the padlock icons next to each of the private entries.

The good news is that it’s not difficult at all. In my case, I use a slightly different modification of this code, however, the below will work for most general purposes.

Before modifying any files, please make sure you have a back up copy.

  1. Upload the padlock image to wherever you want it on your server and make a note of its URL.
  2. Locate all the theme template files that are likely to have a post title in it (i.e. index.php, single.php, archive.php, category.php, and so forth), because in each of these templates you will be adding a bit of code.
  3. Find the reference to the title in each of these template — <a href=”…”><?php the_title(); ?></a> — and add the following code after it:
    <?php if(is_private()) echo '<img src="…" alt="padlock" title="Private" />'; ?> (Remember to link to the location of the padlock image in the source.)
  4. Save and upload your modified files, refresh your site, and you should see padlocks for any private entries.