greet your readers easily with WordPress

Don’t you like to be recognized by name at the coffee shop and have your coffee prepared just the way you like it? Well, you can do that with your blog readers.

If you want to thank your regular readers for their visit and greet them, and encourage new ones to continue reading you with a personalized message, you can do it very easily.

And I don’t mean registered users but simple visitors …

You just have to choose the place in the theme where to place this code and customize it a little to your liking:

<?php
if(isset($_COOKIE['comment_author_'.COOKIEHASH])) {
    $lastCommenter = $_COOKIE['comment_author_'.COOKIEHASH];
    echo "Welcome back dear reader, I hope you enjoy my articles today! ". $lastCommenter ."!";
} else {
    echo "Wow! it looks like you're new here, come in and read, if you don't find something use the search engine.";
}
?>
Code language: HTML, XML (xml)

A couple of good places to put such a code would be before the loop in index.php and in single.php, for example, but you decide.

How useful was this post?

Click on a smiley to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Skip to content