Lighted text in search results

hoangvu

New member
Joined
Jun 6, 2012
Messages
1,833
Points
0
A simple way to make the search results appear in a more friendly way to the user than that provided by wordpress.
To do this simply open the search.php file and find the function the_title()

Replace with:

Code:
echo $ title;
Now before the line just modified simply add the following code:

Code:
<?Php 
	  $ Title = get_the_title (); 
	  $ Keys = explode ("", $ s); 
	  $ Title = preg_replace ('/ ('. Implode ('|', $ keys). ') / Iu', 
		  '<strong> </ Strong>', 
		  $ Title); 
;>
Save the file search.php and open the file style.cs s . Add the following line of code in it:

Code:
strong.search-excerpt {background: yellow;}

That's all! I hope my article be useful.
 
Older threads
Replies
5
Views
4,839
Replies
1
Views
5,924
Replies
6
Views
6,709
PRO
Latest threads
Replies
1
Views
130
Replies
1
Views
115
Replies
1
Views
286
Replies
2
Views
188
Recommended threads
Replies
7
Views
5,150
Replies
2
Views
1,809
Replies
4
Views
6,207
Replies
3
Views
16,221
Top