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.