Display Adsense Search Results Within WordPress Pages

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

  1. Log into your AdSense account and start creating a new AdSense for Search unit.
  2. When you reach the section labeled "Opening of search results page", choose the option: "Open results within my own site".
  3. In the field labeled "Enter URL where search results will be displayed", enter:
    http://yourwebsite.com/gsearch/
    (Replace yourwebsite.com with your actual domain name.)
  4. Continue through the AdSense wizard until you receive:
    • Your Search Box Code
    • Your Search Results Code
  5. Paste your Search Box Code into your theme or a sidebar widget. (For example, use a Text widget in Appearance → Widgets.)
  6. Download the custom page template file: gsearch.zip
  7. Unzip the file and extract gsearch.php to your computer.
  8. Using FTP or your hosting file manager, upload gsearch.php to your current WordPress theme folder.
    Example: /wp-content/themes/your-theme-name/
  9. In your WordPress Admin panel, go to Pages → Add New.
  10. For the page title, type: gsearch
  11. Leave the page content area blank.
  12. In the Page Attributes section:
    • Under Template, select: gsearch
    • Under Slug or URL, enter: gsearch
  13. Click Publish.
  14. 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.

gsearch page example

That's it! You've successfully integrated Google AdSense Search Results into your WordPress site.