- This topic is empty.
-
AuthorPosts
-
October 15, 2010 at 9:04 pm #30569
HenryHunter
MemberHello Forum!
Hey guys I’m trying to incorporate Google’s Custom Search with my site. Google provides me with a piece of code and tells me to add it to my site, but I’m not sure where to add it. Do I add it to my header.php file, or do I actually have to add it to all the pages of my site? Also–and this is important, too–is there a specific place in the file(s) I have to add it?
I will appreciate any help you guys can shoot my way. Thanks.
October 16, 2010 at 5:25 am #77965Bob
MemberYou just add it wherever you want it to be on your website. Just like you’d add a footer div to the bottom of your html document, you add the google custom search wherever you’d like that to appear.
October 19, 2010 at 1:14 pm #77850HenryHunter
MemberHello!
Thanks a lot for this insight Bob. I should have mentioned this before, but I already have a search form in my current theme. Will adding the Google code, say, in the header, get rid of the current search form? I guess I should also mention that I’m no WordPress wizard, so I’m always a bit confused as to how to accomplish these seemingly simple tasks.
Also, I noticed that Google’s Custom Search form says “Custom Search” in the form. Can I get rid of this? Again, I’m thankful for any help.
October 20, 2010 at 7:03 pm #77789Chris Coyier
KeymasterGood question, I would like to know if removing the “Google custom search” text is possible to remove
October 21, 2010 at 6:23 am #77765armin.hackmann
ParticipantHi Henry,
using the ‘Google Custom Search Plugin’ (http://wordpress.org/extend/plugins/google-custom-search-for-wordpress/) would automatically replace the default search form on your WP-Page. Maybe its an option for you?!
As for the ‘Google custom search’ text: Google loads an background-image into the input-field. I suppose you could get rid of it through your stylesheet:
input.gsc-input {
background-image: none !important;
}Or add an image of your own to change the text. :)
Best regards
ArminOctober 21, 2010 at 6:35 am #77766Chris Coyier
KeymasterThanks Armin, I appreciate it!
October 21, 2010 at 9:18 pm #77736HenryHunter
MemberThanks a lot! Does the GCS plugin do the same thing/work the same exact way?
October 21, 2010 at 9:56 pm #77732HenryHunter
MemberSorry to keep nagging you guys about this but the plugin is not working the way I’d expect. I downloaded the plugin, and under the “Google Search” settings I have two fields that I’m to fill up with code:
1) “Paste code for CSE Search Box
2) “Paste Code for CSE Search Results.”However, from my Google Custom Search account I’ve been able to locate only one piece of code, which contains a div, some script, and some styles. I pasted this code into the first field, but the plugin did NOT automatically replace my WP search widget. Actually if you don’t mind check out my site: LearnWriter.com and try searching for “MLA template” and you’ll see what’s happening.
Please, please, please let me know what I should do. Thanks in advance.
October 22, 2010 at 5:03 am #77704jamygolden
MemberLol, I can see what’s going on.
The code you have gotten from google is from the Google Custom Search. You need to apply for an Adsense account and get the Google custom search from there. That will give you 2 pieces of code.
I don’t know why it works this way or if there is a way around it.
October 22, 2010 at 8:54 pm #77632HenryHunter
MemberThanks a lot jamy_za. I have an Adsense account. I’ll look for those 2 codes and see if that solves the problem. Thanks again, man.
October 25, 2010 at 9:44 am #77594HenryHunter
MemberOkay I got the two AdSense codes and pasted them where they belong, but there’s still a very serious problem with my site’s search (plz take a look: LearnWriter.com).
I have a clue as to what the problem could be. When setting up AdSense, I had to include a URL to the page I wanted my search results to open in. I wasn’t sure what page to include so I simply pasted the URL of the page I normally get search results in. I think this is what screwed things up, but I can’t say for sure. What URL am I supposed to include if I want search result pages to open within my site? Am I supposed to create a specific page myself? I have zero clue how this works, so again, any help would be greatly appreciated. Thanks!
November 21, 2010 at 11:42 am #73358HenryHunter
MemberAnyone? I will give the person who helps resolve this issue for me $15 (via Pay Pal). It’s probably a very easy solution, but I just can’t figure it out. And you won’t just be helping me, you’ll be helping out anyone else who has this issue. Thanks folks.
November 21, 2010 at 1:38 pm #72966jamygolden
MemberFirst, create a copy of the page.php file and rename it t ‘page-search-results.php’. Open page-search-results.php and replace the commented area just after
with the following comment:
/**
Template Name: Search Results
**/Now you have a special search-results page template that you can customize.
Now create a page in wordpress called 'Search Results'—before you click 'create', make sure you change the page template to 'Search Results'.
Once that is done, create an adsense account (if you haven't already) and create a Google Custom Search. It will ask you a few questions, like what is the url of the page it will be displayed on, etc. Once this is all done, it will give you two snippets of code. The one snippet is the search box itself—that goes in the header, or sidebar, etc. The second snippet goes on page-search-results.php.
Once you click search, everything should work.November 22, 2010 at 1:45 pm #72773HenryHunter
MemberOkay dude thanks a lot. I’m going to do exactly what you said and get back to you. I already have an adsense account, but I didn’t know what page URL to assign for search results. I’m wondering if the 2nd code needs to go in a particular place in the “page-search-results.php” file. Oh well, I’ll figure it out and get back to you ASAP. Thanks again man.
November 26, 2010 at 11:44 pm #72187HenryHunter
MemberI think you want me to add the “Template name: Search Results” part BEFORE the first “ thing right?
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.