DISQUS

LiewCF Tech Blog: Google AdSense Search Results within WordPress Pages

  • CypherHackz · 3 years ago
    nice post you have there. i will try to implement them later. ;)
  • Shivaranjan · 3 years ago
    Thanks Liew, very useful post. Hope if I can increase my earnings from google adsense.
  • ahwong5 · 3 years ago
    May i know what is the purpose of "Make sure the Post slug is "google-search"?

    Thanks for your explanation!
  • LcF · 3 years ago
    @ahwong5: the "post slug" is related to the URL in Step 1, BOTH need to be the SAME.

    Since we use "google-search" in Step 1, then we need to make sure we are using "google-search" as post slug in Step 3, too.
  • e-tech · 3 years ago
    Great tutorial,
    cheers
  • JohnTP · 3 years ago
    I can't search on your site with Adblock Plus Firefox extension enabled. You have to do something about this as many people use this extension
  • LcF · 3 years ago
    @John TP: Well, the Google AdSense code is not under my control. You might need to unblock Google AdSense in AdBlock Plus for it to work.
  • xion · 3 years ago
    yaya... adblock almost blocks all adsense...
  • E-kereta.com · 3 years ago
    TQ for the info...i will try it at home tonite
  • worldcupcorner.com · 3 years ago
    Check out my on site search:
    http://www.worldcupcorner.com/search/

    I must tweak the design more...
  • Fili · 3 years ago
    Hey,

    Thanks for the helpful post. One question - what's with the big white space that shows up after the search results. Anything that we can do about that?
  • LcF · 3 years ago
    @worldcupcorner: nice color theme, look like part of your site. :)
    @fiLi: the AdSense search result page's default height is 1500px (googleSearchFrameHeight = 1500). I don't think we can modify the code...
  • Will · 3 years ago
    Hi - just wanted to thank you very much for providing this. It worked first time - and I've been trying to do it (using other people's advice) for days and days. Brilliant! Shame it looks so crap and we can't change the height or width of the frame (well, I can't). Cheers!
  • LcF · 3 years ago
    It is easy to change the width and height of the frame... but I don't think Google allows us to do so. According to Google AdSense program policy: NO code modification.
  • Fili · 3 years ago
    Altering the code in the obvious places doesn't help. It seems that the place is reserved for ads on top of the search.
  • aman · 3 years ago
    nice post you have here. I will try and wrote my comment here later.. :P
  • Vincent Chow · 3 years ago
    I discovered this when they first introduced this, but I'm not sure how to make it. Thanks for the tutorial.
  • Fahmishah · 3 years ago
    nice..its really work!
  • manas · 3 years ago
    Thanks. Your instructions were very useful.
  • borzack · 3 years ago
    Hi...
    I've implemented it to my site!
    After 3 hours working on it, try this, try that, finally it matches my template and looks good! but the search result is kinda lame...
    Please visit my site to check it out!
    Thanks
  • Dennis Bjørn Petersen · 3 years ago
    Man sometimes I feel like a WP-noob.

    I've done exactly as written above but I can't get it to work. I've add the search field at the bottom of my frontpage. (I'm going to move it up once I get it up and running). The problem is when I click the search button it takes me to a blank page. My blog is installed in a folder called blog, do I have to change anything?
  • Andrew Ooi · 3 years ago
    Fantastic. It was easy following your instructions Liew. I got mine working in under 15 minutes. Also added headers for Google adsense and at the side too beside the results.

    Not sure whether this was allowed or not but since I see you doing it, I guess it's alright :)
  • Kenneth · 3 years ago
    Hello there,

    I don't understand how come it returns me with this line:

    Fatal error: Call to undefined function: get_header() in /home/kenneth/public_html/wp-content/themes/flawless-imperfection/googlesearch.php on line 11

    I would be grateful if you could help me out.

    Regards,
    Kenneth
  • LcF · 3 years ago
    @Kenneth: you should put the wordpress page's URL in the adsense search, NOT the path of the googlesearch.php.
  • Kenneth · 3 years ago
    I'm sorry Liew, but could you elaborate more? I still do not understand. FYI, I put my googlesearch.php in /public_html/wp-content/themes/flawless-imperfection.
  • Kenneth · 3 years ago
    This is how I put it in my header (where I want the search box to appear):
    ….form method = ” get ” action = ” http://mrdefinite.com/wp-conte.../flawless-impe... target….
  • LcF · 3 years ago
    @Kenneth: you should put "http://mrdefinite.com/?page_id=577" as the search page URL, not the /wp-content/blahblah...
  • Kenneth · 3 years ago
    Liew, I have changed what you said, but what should I out in my post slug? Cos it still doesn't seem to work..
  • raj · 3 years ago
    Excellent! Worked the first time. I just love to see a post with steps which works the first time. Thank you so much!
  • miCRoSCoPiC^eaRthLinG · 3 years ago
    Hi,
    First of all, terrific instructions. I had it working right at the first try - though it took me a while to get the search box blend in into my template.. even now it looks kind of ugly - but that's irrelevant. Those who still haven't managed to figure it out are most welcome to drop by my site and ask for any kinda help needed on this.

    My question is - when I create the search page, using the googlesearch.php template as you've shown - that page shows up in the horizontal top-menu as an item named "Google Search". Any ideas how to get rid of this ??

    Thanks,
    m^e
  • Matthieu · 3 years ago
    Hello,

    thanks for this helpful post. Just implemented my Google Search WordPress page on my blog.

    Cheers,
    Matt
  • gary · 3 years ago
    very cool thanks. btw the next step is to exclude the 'google search' link from the navigation area. The solution is to use the exclude parameter as shown in the wp codex.
  • miCRoSCoPiC^eaRthLinG · 3 years ago
    Thanks gary, for the tip - till now not knowing what to do, I'd commented out the wp_list_pages() function and was adding in links manually in the header, which of course was a bitch and a so totally inelegant way of doing so. Now all's fine :)
    Cheers,
    m^e
  • q-i · 2 years ago
    Thanks a lot, this is a very helpful article.
  • Dennis Bjørn Petersen · 2 years ago
    Works like a charm.

    I guess it was the previous theme that caused me some trouble.

    Thank you Liew.
  • Bozak · 2 years ago
    I get the following error when I try to view the page I created using the googlesearch page template:
    Parse error: parse error, unexpected T_DNUMBERon line 9

    Any ideas? Thanks for your help.
  • John Stern · 2 years ago
    How came that if I try to search at the top of page, I get the Google page and not a site template? I was only trying to find an example of the plugin!
  • Simon · 2 years ago
    I've just started blogging in the last week and am finding myself stumbling along slowly with many things right now as I pick things up.

    I spent hours trying to get my custom Google search page sorted, then found this site and had it sorted in 15mins, many thanks for a great step-by-step guide!
  • David · 2 years ago
    Great post...thanks! One question though, how come you don't do this on your blog? I tried out your search but it's not setup. :-)
  • LcF · 2 years ago
    @David: thanks for the remind. The on-site search was returning error after I upgraded WordPress to version 2.0. I will implement it again. :)
  • Clara · 2 years ago
    Hi Cheon Fong, thanks for the details! Now the search results page looks like it belongs to the site.
    However the frame height variable doesn't seem to have any effect on the page look - still a block of white space before the footer.
  • Dennis Bjørn Petersen · 2 years ago
    For some very weird reason. The search results in Firefox are blank, but it works fine in Opera and IE7. It says PHP: on the search result page.
  • Stefan · 2 years ago
    Worked like a charm! Thanks!
  • Navjot Singh · 2 years ago
    Just yesterday I was trying to implement this feature into my blog. And then today I found your tutorial. Very helpful. I will try this today and test. Thanks a million.
  • Make Money blogging · 2 years ago
    This is an awesome tutorial, thank you much!!

    Worked Perfect!

    Also I was able to put the Search Code in the PHP file that way if the use wants to search again from the same page they can.
  • fisketur.net · 2 years ago
    Thanks a lot for the very useful info. I've spent a few hours trying to figure out how to get the search results to show up on my page, and you've saved me from wasting any more time :) Works like a charm now.

    Cheers!!
  • sciencebase · 2 years ago
    I had implemented this on my sci-tech news site, Sciencebase.com, months and months ago, but totally forgot how to do it to get started on my blogging tips site. Thanks for the timely reminder

    Dave B
  • Gauhar · 2 years ago
    I don't have a "Page Template" widget on my wordpress control panel. i use Wordpress 2.3.1

    How can I implement it?
  • ProPhotographer · 1 year ago
    Great tutorial. Worked first time.

    Many thanks.

    PP
  • Rajeev Edmonds from Adsense Pr · 1 year ago
    Simple 3 step process. Excellent, I was searching for this. Now I can easily integrate customized Google search page on my blog.
  • Syahrial Ali · 1 year ago
    Greats Liew. It works now.
    Thanks a lot
  • Bld · 1 year ago
    Thx liew for this tip. now i can setup this search engine
  • Mike · 1 year ago
    Good work!
  • Ankur Gandhi · 1 year ago
    Hello Mate,

    Thanks for your nice post, But i want to put adsense search box like your site in which user can select either Web or Site.
    How can i put search box like you. Please help me.
    and one problem is that my adsense search box is showing inactive. I dnt know why??
    Have u any idea about that. Please help me.
    Thanks in Advance.

    Ankur Gandhi.
  • LcF · 1 year ago
    @Ankur Gandhi: the adsense box format that I use on this site is no longer available. it has been replaced with better adsense custom search. you can read more at https://www.google.com/adsense/support/bin/topi...
  • Saijo George · 1 year ago
    great post mate , you can actually take it one step further ans integrate the ads in to the page that you create on wordpress itself so it looks much more integrated on to the site. I have written a post about it on my site.
  • Dave · 1 year ago
    Thanks for this, it works perfectly.
    Well, almonst. I just need to figure out a way to make it fit in with my theme.
    Thanks again, I would never have thought of using a page tempate.

    Dave
  • kiwi freelancer · 1 year ago
    u have idea for adsense code integrade with wp searh...!
    please help me
  • dantel · 1 year ago
    Just yesterday I was trying to implement this feature into my blog. And then today I found your tutorial. Very helpful. I will try this today and test. Thanks a million.
  • Barock · 11 months ago
    wow..thanks, i currently looking for this,, it's really helpful
  • logga44 · 3 months ago
    Thanks! Great article. Was just what i was trying to do, saved me heaps of time and stuffing around.
  • Englishpack · 3 months ago
    I'm using WP-Clear of solostream. everything is done as you said except step 3 "On the right, expand Page Template: and select "google search" (googlesearch.php)." I don't see any page temp to select the file which has been uploaded. What should I do? Please reply fast or email me. You can see my problem @ http://englishpack.com/google-search-results/