Adsense for Search
Does anyone have current information for manually installing Google Custom Search w/ Adsense? There’s some conflicting information out there on the web, and it all seems outdated, for WP 2.7 and earlier.
I’ve tried several installations but no luck with getting the search to actually work.
Here’s what I’ve got:
Google Custom Search in the right place.
I understand the other code goes in the search.php file, but doing so isn’t working. I’m not quite skilled enough in php to know what goes where, what to take out, etc.
1. Do I need to create a Search Results page in the Pages function of the dashboard?
2. Anyone have working code for a search.php page that includes Google Custom Search
3. Do I have to create a brand new search.php, or can I just modify the old one by using new code?
No really though, I know lots of people do this, can anyone help please? 🙂
In case anyone needs help with this in the future, I figured it out and this is what I did:
1. Google provides you with two sets of code. The code in the top box the code that generates the search box. Find your theme’s search box code. Mine was in the header file. I just deleted the old code and inserted the new code.
2. Then, I created a page called Search Results. For the slug, I named it search-results.
3. In the HTML view of the search-results page, paste the 2nd code provided by Google. Save the page.
That’s it! From that point, it’s pretty much finished and ready to go, but here’s some other notes that might answer a question or two:
I excluded the Search Results page out of my navigation since it won’t be in use except when someone uses search. I suggest you do the same unless you want a random search page with nothing on it showing in your navigation.
Also, you will need a search.php file in your theme for this to work, I think. Not entirely sure, but pretty sure. My theme has one, but I’m too much of a chicken to delete it and see if it still works, so I just leave it there.
If you need to make a search.php file, that’s beyond my level of experience, but I will leave this thread open as unresolved for a few days in case anyone has any questions about implementing Google Custom Search.
There’s a plugin which allows you to do this.
I’ve done it creating a page from the dashboard (like you) without the search.php in my theme and my custom search works perfect when I search from my home page.
However, when I search from a category page, for some reason I get a 404 Error – file not found every time. Even when I know the search parameters I’m tying to query are in fact tags that should be found.
Have you tested to see if your search box is working on the pages outside your home page? Just curious.
By the way, I’m dying to get some help on my troubleshooting question regarding google custom search if someone could help me. Here’s my post asking for help: http://wordpress.org/support/topic/google-custom-search-in-wordpress-1?replies=1
- The topic ‘Adsense for Search’ is closed to new replies.