• Resolved archshrk

    (@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 = 'www.google.com';
    </script>
    <script type="text/javascript"
    src="https://www.google.com/afsonline/show_afs_search.js">
    </script>
    <!-- Google Search Result Snippet Ends -->

    https://www.google.com/support/adsense/bin/answer.py?answer=43862

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.

    Regards,

    Vrajesh

    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:

    <?php
    /*
    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.

    Thread Starter archshrk

    (@archshrk)

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

    https://www.liewcf.com/blog/archives/2006/09/google-adsense-search-results-within-wordpress-pages/

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