Display Google AdSense Search Results on Your WordPress Site. By default, Google AdSense for Search displays search results on a Google hosted page. However, website owners can configure AdSense to show those results directly on their own site using a custom landing page. This tutorial explains how to integrate AdSense search results into your WordPress site using a custom page template.
Display Google AdSense Search Results on WordPress
- Log into your AdSense account and start creating a new AdSense for Search unit.
- When you reach the section labeled "Opening of search results page", choose the option: "Open results within my own site".
- In the field labeled "Enter URL where search results will be displayed", enter:
http://yourwebsite.com/gsearch/
(Replaceyourwebsite.com
with your actual domain name.) - Continue through the AdSense wizard until you receive:
- Your Search Box Code
- Your Search Results Code
- Paste your Search Box Code into your theme or a sidebar widget. (For example, use a Text widget in Appearance → Widgets.)
- Download the custom page template file: gsearch.zip
- Unzip the file and extract gsearch.php to your computer.
- Using FTP or your hosting file manager, upload gsearch.php to your current WordPress theme folder.
Example:/wp-content/themes/your-theme-name/
- In your WordPress Admin panel, go to Pages → Add New.
- For the page title, type: gsearch
- Leave the page content area blank.
- In the Page Attributes section:
- Under Template, select: gsearch
- Under Slug or URL, enter: gsearch
- Click Publish.
- Return to your site and test your new AdSense-powered search. When users search from your custom search box, results will now be displayed on the
/gsearch/
page of your own site.
That's it! You've successfully integrated Google AdSense Search Results into your WordPress site.