Google Search on Your Widgets

In this post, I’ll explain how to embed google search in Wordpress blog. First you must use Wordpress 2.3 or below, and have Wordpress theme with widgets supported. In this example I used Wordpress 2.5.1.

After login to your blog, go to design menu, and widgets. Then drag text to sidebar, click edit button in Text widget to edit tittle and give it some script.

The tittle if up to You. Copy this script to text area of Text widget:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!-- SEARCH ENGINE GOOGLE -->
<script language="JavaScript">
<!--
//Script Author: Einchi
function netsearch(formname){
var a1
var a2
var TEXT
var haveTEXT
TEXT=formname.TEXT.value;
haveTEXT=true;
if(TEXT=="")
{
alert("No text to search!")
haveTEXT=false
}
//GOOGLE
a1="http://www.google.co.id/search?q="+TEXT;
if(haveTEXT)
{
newWindow=window.open(a1)
}
//ENDSCRIPT
}
//DONE HIDING-->;
</script>
<form name="engines">
<p align="justify">
<input maxlength="200" size="15" value="" name="TEXT">
<br /><br />
<input onclick="netsearch(engines)" type="button" value="Search!">
</p>
</form>
<!-- END OF SEARCH ENGINE GOOGLE -->

Save change and try to see Your Blog and search with Google=)

If it doesn’t work, please leave your comment. Thanks.



Related Post:

Post a Comment

Your email is never published nor shared. You're allow to say what you want...

Blogroll Link Update