Skip to content

Instantly share code, notes, and snippets.

/search.php
Created Feb 20, 2017

Embed
What would you like to do?
<?php
$titel = get_the_title();
$auszug = get_the_excerpt();
$suchwort = chop(get_search_query() );
$wert = explode(" ",$suchwort);
$titel = preg_replace('/('.implode('|', $wert) .')/iu','<mark>\0</mark>',$titel);
$auszug = preg_replace('/('.implode('|', $wert) .')/iu','<mark>\0</mark>', $auszug);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.