hi. Today was my third attempt at getting the Adsense Search results to display within an iframe of my wordpress blog. After a few hours, I have failed again.
I am using the google code for the form and results directly from google’s page. (see below).
If I put the form action to be “search-results.php”, then when you hit search, it looks to the root director of my domain, and not in the theme folder.
to fix this, I put a search-results.php in the root folder, but I got an error message (Fatal error: Call to undefined function get_header() in /home/mbartizmo/englishcurrent.com/search-results.php on line 7)
So I removed the <?php get_header(); ?> and get footer lines from the search-results.php. I left it just with the google code:
var googleSearchIframeName = “cse-search-results”;
var googleSearchFormName = “cse-search-box”;
var googleSearchFrameWidth = 800;
var googleSearchDomain = “www.google.com”;
var googleSearchPath = “/cse”;
This works. But it just displays results. I kind of want my header & footer to display.
I tried changing the form action to “”/wp-content/themes/sandbox-162/search-results.php” (my wordpress theme folder) but I get the same error (Fatal error: Call to undefined function get_header() in /home/mbartizmo/englishcurrent.com/wp-content/themes/sandbox-162/search-results2.php on line 7)
you may be asking: why don’t use just make a template, or put the results code in a page on your blog. I have tried that and both methods return no output. I’ve noticed that on blogs that have successfully implemented these methods, the URL of the results page will be something like “search-results/?cx=partner-pub-1463763749981328%3A398bkh-36ye..”
When I try it with the two aforementioned methods, none of this data in the URL after the question mark comes thru. the URL just says “http://www.englishcurrent.com/search-results/” without any of the lovely stuff after the question mark.
that’s where I stand. here’s my searchbox code at the moment:
<form action=”search-results.php” id=”cse-search-box”>
<input type=”hidden” name=”cx” value=”partner-pub-4361821199782454:9184209789″ />
<input type=”hidden” name=”cof” value=”FORID:10″ />
<input type=”hidden” name=”ie” value=”UTF-8″ />
<input type=”text” name=”q” size=”18″ />
<input type=”submit” name=”sa” value=”Search” />
any help would be appreciated.
- The topic ‘Adsense Search Box no results Sandbox theme’ is closed to new replies.