When Google let users add AdSense for Search results on my own site, I tried to install it. I want to keep elements like the header, footer, and site navigation panel the same for the search results page I create. You should try this new feature to your wordpress.
To use it, just choose the “Open results within my own site” radio button when you’re generating your AdSense for search code. You’ll also need to identify the page where you’d like to display your search results.
Google will give you two sets of code: one for the search box, and one for search results. Place the first set on a page where you’d like the search box to appear, and the second set on the page you’d like the search results to appear. Whenever users perform searches on your AdSense for search box, they’ll be directed to the page on which you placed the search results code.
It’s sound so easy. I just tried it and I couldn?t get it to work on my blog What is wrong? Therefore, I search to find the solution of my problem. I get a solution from macstansbury for my problem. Thanks for your tutorial.
Here are steps to install Google AdSense for Search on WordPress:
Create a new page named “Search Results,” or something similar.
Put your search box code in your sidebar or wherever you decide. I put this code in searchform.php and call this function on my sidebar.
Set up the search to point to the page your created.
After you put the Search code where you want it, do a search for anything.
The result page you get will have no results. For some reason, any header javascripts interfere with the Search code. I think this is a main problem. Let’s fix this problem.
Create a new page template in your theme folder. The theme would start with this as the first line:
< ?php
/*
Template Name: Google Search
*/
? >
Feel free to named this template.
Upload this to your theme folder in a moment, after you’ve titled the file googlesearch.php and saved it.
Go to the search page you created (the one I named “Search Results”), and get the HTML for the page. You?ll need to copy it and paste the actual code into your googlesearch.php file. Look through the code, and take out any javascripts in the section. Also take out any of the admin code, such as the one for editing the page. You’ll need to take out any javascript-dependent elements from your page, as well. I take out sidebar code, because Google Search result will overlap my sidebar
Save your googlesearch.php file, then upload it in the same folder as the theme you’re using right now.
Go into edit your search results page and change the Page Template to “Google Search” (or whatever you named the template) and save the page.
Well done! You’ll get get the results I get!
Try search something on my blog just for test.
0 comments:
Post a Comment