frankiehayward
11/27/2017 - 4:20 PM

Display Custom Content to Search engine Visitors

Display custom content to your search-engine traffic by placing mm_from_search_engine.php into your theme’s functions.php file. After checking and editing the $SE array with the search-engine referrer information of your choice, place call_function_mm_from_search_engine.php chunk of code into the desired display location in your theme file(s).

<?php
if ( function_exists( 'mm_from_search_engine' ) ) {
	if ( mm_from_search_engine() ) {

		// INSERT YOUR CODE HERE

	}
}
?>
<?php
function mm_from_search_engine() {

	$ref = $_SERVER['HTTP_REFERER'];
	$SE  = array('/search?', '.google.', '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;
}
?>