This article will show you how to add Google Custom Search with Adsense to your WordPress blog.
OMG was this a pain in the… well you get the idea. Oh, sure now it is a piece of cake, so simple, whatever! Grr!! Okay, now that I spent hours searching and figuring it out, here is how I made it work and it doesn’t even require plugins or anything fancy.
First off I will assume you already got your google custom search code and you are stuck. You have the code from adsense, but can’t make it work.
Here is what I did:
Going back to modify or edit the code from google adsense, under “What to search“ I selected “Only sites I select“ Then under “Specify a list of websites to search, one URL per line. You will be able to edit this list and add more sites later.” I wrote *.jdsportsonline.com As you notice, my site is http://jdsportsonline.com, so that basically told it to search the entire site.
Then select whatever options you like and as for Search results I selected on my website using an iframe now we know iframes doesn’t work on WordPress, but I have made them work before and this time it is nothing like that kind of hassle. It will be easy.
Now this next part is like the chicken before the egg. We need a post, but we need the code, can’t make the post without the code and can’t make the code without the post… lol.. Anyway, under URL where search results will be displayed: I put http://jdsportsonline.com/sportsbetting/custom-search.html Which basically means I will need to make a post under the category sportsbetting and call it custom search. Next it wouldn’t allow me to put a width of 600, so I had to change that latter when I actually pasted the code.
Okay, now we are moving along. Then you click save and get code and up pops the Search Box Code. You should have two boxes, one for the Search box and the other for the Search results.
The search box is pretty easy. You go to your wordpress admin and click the Appearance tab and then editor and look for your searchform.php. Now at this point I, just to be safe, opened a note pad and copied and pasted the current searchform.php. Then you copy your google Search box code and paste it in your searchform.php and update.
Now you need to make a post called custom search. This is a little tricky, so follow carefully. I will assume you already have it set to make html url by name and not the other settings. Okay, you have named your post and the permalink under the title matches the url you said you wanted the search results displayed at. Make sure you have it in the right category. Next under the Discussion heading at the bottom uncheck allow comments and uncheck allow trackbacks and pingbacks. Okay this next part in very important make sure you are in HTML mode and not the visual mode and paste your Search results code. You can change that 800 frame width to 600 now. Okay, whatever you do, DO NOT click back to visual mode. Just Publish it while still in HTML mode and then leave.
That is all there is to it. Pretty simple right Of course if you didn’t find this explanation right off you probably have been pulling out your hair. You might have even added a plugin or something. I know, because I did the same thing, lol.
Well, I hope this helps and you have a wonderful day,
JD
Well I started my blog in the beginning of March, I have 21 different entries already. How soon do you think the web crawler will pickup my blog and index it into the search engines ?.