The following describes only the WordPress integration method. for other systems, see. The following placement method is a typical WordPress application. search columns are placed in the sidebar Widge or the top Banner, and the search results are placed on a separate page. The results are the same as those in rural property management. Key: The search box and the search result are not displayed on the same page. you need to modify the default search box and create a Searc manually.
The following describes only the WordPress integration method. for other systems, see. The following placement method is a typical WordPress application. search columns are placed in the sidebar Widge or the top Banner, and the search results are placed on a separate page. The results are the same as those in rural property management.
Key points:
- The search box and search result are not displayed on the same page.
- You need to modify the default search box
- You need to manually create a Search page to display Search results
The usage is as follows:
1. First, you must log on to the ingress.
2. after the creation is complete, click "appearance" on the left and select "two pages", for example:
3. click "save and get code ".Search boxAndSearch ResultsEnter your Page address in the specified URL to display the Search result. for example, icultivator.com/search. make sure that the address you entered can be properly accessed. (if you refer to this article, you must be able to open the Search Page to be created below ).
4. the code example in the search box is as follows (the content of the form element depends on your website. here, we only use my website as an example ):
《script》 (function() { var cx = 'your_custom_id'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })();《script》
The above You can also write your own domain name, for example, my website can write: Ghost.
5. search result display page code
This part of the code can be completed by creating a search page. the search result code displayed in the search file is as follows:
《script》 (function() { var cx = 'your_custom_id'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })();《script》
6. the final application result is the same as the search box on top of Nongfu Manor and the search result page: