Add Baidu intra-site search in wordpress

Source: Internet
Author: User

Integrate wordpress with Baidu site search results

First, let's look at the effect of tribe integration, as shown in the figure below:

It can be seen that this effect is much better than using a second-level domain name for resolution, and the advertisement or anything is still the original.

The operation process is also very simple. We only need to layout a small piece of code to implement this function.

1. First, you need to create a page in the wordpress background, such as the page created by the tribe, named searchbaidu:

You can see some code on this page. You don't need to worry about it. The tribe will teach you how to get the code.

2. Next, go to the search backend of the Baidu site and find the search result page for management. You can also go directly to this page.

Have you seen the code in the figure? Copy the code and add it to your website to display the search result location, that is, copy it to the page you just created. The code obtained by the tribe is as follows:

<Div id = "bdcs-frame-box"> </div>
<Script type = "text/javascript">
Var bdcsFrameSid = "2446013709247334931 ";
Var bdcsFrameWidth = 552;
Var bdcsFrameWt = 1;
Var bdcsFrameHt = 2;
Var bdcsFrameResultNum = 10;
Var bdcsFrameBgColor = "# ffffff ";
</Script>
<Script type = "text/javascript" src = "http://zhannei.baidu.com/static/js/iframe.js"> </script>

The tribe needs to prompt,

Var bdcsFrameHt = 1;

This is the default value. We can change the value to 2. In this way, the search results are displayed at the top of the search results.

3. Next, we will search for this page on the Baidu site. We need to set the Advanced Style and move the page above down to see:

Add the page address you just created. For example, add/searchbaidu to the tribe.

4. next, we need to layout the search code where you want to display the search box. it is usually in the sidebar or on your top. the tribe is placed at the beginning of the sidebar. the code is as follows:

<Forms method = "get" class = "qfg_search_form" action = "http://www.mfbuluo.com/searchbaidu">

  1. <Input class = "qfg_search_box" type = "text" name = "q" id = "s" class = "input" value = "Baidu intra-site search" onBlur = "if (this. value = '') this. value = 'Baidu intra-site search'; "onFocus =" if (this. value = 'Enter the keyword ') this. value = '';"/>
  2. <Input class = "qfg_search_btn" name = "submit" type = "submit" value = "search"/>
  3. </Form>

Note that the address in the action segment should be replaced with your address, that is, the page address you created.

You can adjust the style by yourself. It does not matter if you do not adjust the style. The above code is used by the tribe, as shown in the figure below:

After all, wordpress's full intra-site search is complete. Of course, the additional information is that the robots.txt setting should not allow the search engine to capture this file:

Disallow:/searchbaidu

Summary

The tribe has tried it for the moment, and the effect is quite good. You can try it for all the friends you need.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.