wordpress整合百度站内搜索

十度 wordpress 2015年12月20日 收藏

前面讲到wordpress整合Google自定义搜索很多朋友都提到能不能使用百度的搜索,因为大家都知道中国的政策是不是的会让google出现不能访问的局面。
不过目前百度的站内搜索还没有像Google那么强大可以将搜索结果放在本站页面中,只能实现在百度的域名下实现站内搜索,代码如下:

<!-- 百度站内搜索 -->
<form action="http://www.baidu.com/baidu" class="search-form" target="_blank"> 
<input class="search-input" name="word" type="text" placeholder="输入 回车搜索" autofocus x-webkit-speech="" onfocus="if (this.value == '输入 回车搜索') {this.value = '';}" onblur="if (this.value == '') {this.value = '输入 回车搜索';}" value="<?php echo $_GET['s']?$_GET['s']:'输入 回车搜索'?>">
<input type="submit" value="搜索" class="search-submit">
<input name=tn type=hidden value="bds"> 
<input name=cl type=hidden value="3"> 
<input name=ct type=hidden value="2097152"> 
<input name=si type=hidden value="www.shouce.ren"> <!-- 此处www.shouce.ren替换为你的网址-->
<input type=hidden name=ie value="UTF-8">  <!-- 本站编码为UTF-8-->
</form> 

提示:如果网页采用utf-8代码,则需要在代码中加入

<input name=ie type=hidden value=utf-8>

否则搜索关键词会出现乱码。