that jon jackson

replace “Protected:” text from a password Protected WordPress post with an image

November 6th, 2009
VN:F [1.8.2_1042]

Our Goal is to turn a page that looks like this:

2009-11-06-141204

To a page that looks like this:
2009-11-06-141730

What file to do you edit?

  • in the wp-includes folder
  • post-template.php” file arount line 111 (See images below for reference)

Original Code Unedited:

2009-11-06-141914

Edited Code :
2009-11-06-141843

Full original code: begins Line 111
if ( !is_admin() ) {
if ( !empty($post->post_password) ) {
$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
$title = sprintf($protected_title_format, $title);

Final Edited Code: begins Line 111
if ( !is_admin() ) {
if ( !empty($post->post_password) ) {
$protected_image_title = "
<IMG SRC=http://www.yourdomain.com/img/padlock.gif id=no>";
$protected_title_format = apply_filters('protected_title_format', __('%s'));
$titles = sprintf($protected_title_format, $title);
$title = "$protected_image_title $titles";
// $protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
// $title = sprintf($protected_title_format, $title);

The same thing will work with the “Private:” pages, but i wasn’t concerned with those.

VN:F [1.8.2_1042]
Rating: 0 (from 0 votes)

you might also like...

How to for Career Development Partners – Fixing a broken div image in wordpress switching an image using the featured content gallery plugin for wordpress the one in which i explain how to add thumbnails into your wordpress rss feed embedding a private scribd document into wordpress 2.9.1 HOW TO: windows live writer posting to a self hosted wordpress blog
brought to you by YARPP.

Leave a Reply

that jon jackson, a freelance designer of graphics. and screenprinter of t-shirts.
918.970.0001 | Copyright © that jon jackson.