Support » Installing WordPress » Open Google Search results within my own site

  • Resolved archshrk


    According to Google, you can now have the google search open within your own site, but I don’t know how to make it work in WP. I want to add this to a page or php file, right? But it doesn’t seem to work.

    <!-- Google Search Result Snippet Begins -->
    <div id="googleSearchUnitIframe"></div>
    <script type="text/javascript">
    var googleSearchIframeName = 'googleSearchUnitIframe';
    var googleSearchFrameWidth = 700;
    var googleSearchFrameHeight = 1500;
    var googleSearchFrameborder = 0 ;
    var googleSearchDomain = '';
    <script type="text/javascript"
    <!-- Google Search Result Snippet Ends -->

Viewing 3 replies - 1 through 3 (of 3 total)
  • You need to do 2 steps for it, First setting up the search box. Second is you need to set the page where you want publish the result, it can be any type of page, i think. And you need to put the another code inside that page.

    However, it seems google uses iframe concept for it.



    You need to add the code to a page template. Make a copy of page.php (or index.php if your theme doesn’t have page.php). Make sure you give it a unique name with code like this at the very top:

    Template Name: Search

    Insert the Google code into the new template after the code for the loop but before the closing </div>. Save and upload.

    Now create a new page using your new template. You don’t need to put anything in the post section, just the title will be fine. If you’re using pretty permalinks, set the slug to something useful like “search”.

    Save your new page, and make sure it loads.

    Now go to your Adsense setup, and enter the URL of your new page in the settings.

    LesBessant – you are correct. I was formating my “search page” incorrectly. Found this guide quite helpful.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Open Google Search results within my own site’ is closed to new replies.