Display custom content to your search-engine traffic by placing the following code into your theme’s functions.php file:
<?php function scratch99_fromasearchengine() {
$ref = $_SERVER['HTTP_REFERER'];
$SE = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
foreach($SE as $source) {
if(strpos($ref, $source) !== false) return true;
}
return false;
} ?>
After checking and editing the $SE array with the search-engine referrer information of your choice, place this next chunk of code into the desired display location in your theme file(s):
<?php if(function_exists('scratch99_fromasearchengine')) {
if (scratch99_fromasearchengine()) {
// INSERT YOUR CODE HERE
}
} ?>