• Hello! This is probably a simple question for you coders out there.
    I have watched a few tutorials about how to add your google adsense search to your wordpress site but with my theme, I am not sure where exactly I am suppose to post the codes…

    In the tutorials, it says there is a search.php and also a searchform.php. My theme (magazino) ONLY has the search.php (for the results). You are suppose to copy and paste the search results code snippet from google in to the search.php and in the searchform.php, they say you are suppose to copy and paste the form code. However, with my theme, I am not sure where the form code goes. Any ideas? For a visual on where my search form is click here.

    See at the top of the website how you click the search button and the search form comes down? Pretty cool but, I am not sure where that code is so I can replace it with the google code.

    I hope this makes sense!
    THANKS!!
    Sara

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Sara,

    First of make a backup for your header.php file.

    Go to header.php

    Next find the <div> with id=”close-x”

    Below it, you will see the <form>……</form> code

    replace the <form> </form>code with your google search code.

    Save header.php and then have a preview of your site. That should do it.

    Thread Starter Zedler815

    (@zedler815)

    Thank you for your reply! However, I am unable to find the <form…</form> code in my header.php.
    The codes that come close are…

    <?php wp_head(); ?>
    </head>

    <body <?php body_class(); ?>>

    <div id=”container”>

    <div id=”search-box-wrap”>
    <div id=”search-box”>
    <div id=”close-x”><?php _e( ‘x’, ‘magazino’ ); ?></div>
    <?php get_search_form(); ?>
    </div>
    </div>


    <div id=”search-icon”></div>

    </div>

    </div>

    <nav id=”access” class=”clearfix” role=”navigation”>
    <h1 class=”assistive-text section-heading”><?php _e( ‘Main menu’, ‘magazino’ ); ?></h1>
    <div class=”skip-link screen-reader-text”>“><?php _e( ‘Skip to content’, ‘magazino’ ); ?></div>
    <?php magazino_main_nav(); // Adjust using Menus in WordPress Admin ?>
    <?php //get_search_form(); ?>
    </nav><!– #access –>

    —————–
    Any ideas?
    THANKS!! 🙂

    Try looking in searchform.php for <form> tag

    Ah Allright, so your your search form is being generated by calling a function <?php get_search_form(); ?>

    Now you should replace the following line with your google search code:

    <?php get_search_form(); ?>

    That should integrate google search instead of default search bar.

    Note: Make sure to Make a BACKUP Before making any changes!!!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Integrating Google Search’ is closed to new replies.