Lighted text in search results

Marc0

Well-known member
Registered
Joined
Jun 6, 2012
Messages
888
Points
28
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
1
Views
2,890
Replies
1
Views
4,800
Replies
11
Views
5,704
Replies
23
Views
12,513
Latest Threads
Replies
1
Views
1,338
Replies
3
Views
1,108
Replies
1
Views
703
Replies
2
Views
1,289
Replies
1
Views
868
Recommended Threads
Replies
2
Views
5,069
Replies
5
Views
5,553
Replies
15
Views
8,568
Replies
67
Views
29,964
Replies
0
Views
3,200

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top