This topic has 9 replies, 2 voices, and was last updated 9 years by Laura.

  • Author

    Tagged: 

  • #78404
     cityofbuckeye
    Participant

    Hello –

    I would like to add google custom search to the theme to replace the existing search. I am currently using the a plugin to facilitate https://wordpress.org/plugins/google-custom-search/. The plugin provides the following instructions to add php code to the theme, but I need help identifing what php files to update and where within the code. Not sure if this is out of the scope of service you provide with the customer service but any help would be greatly appreciated.

    From plugin installation page.
    ____________________________________________________________________________________________________________
    To display the search-box anywhere in the code, the following method should be used

    <?php display_search_box($display_results_option); ?>

    where $display_results_option is one of the following three options:

     DISPLAY_RESULTS_AS_POP_UP – display the search results as a pop-up resizeable dialog
     DISPLAY_RESULTS_IN_UNDER_SEARCH_BOX – display the search results under the search box
     DISPLAY_RESULTS_CUSTOM – display the search results in the place you have specified.
    e.g: <?php display_search_box(DISPLAY_RESULTS_AS_POP_UP); ?>

    To specify a location where the search result is to be displayed, the following method should be used.
    <?php display_gsc_results(); ?>
    ____________________________________________________________________________________________________________

    My site: http://345.374.myftpupload.com/

    Thanks you in advance.

    #78525
     Laura
    Moderator

    Hello, so if i understood well, you should edit the header.php and add <?php display_search_box($display_results_option); ?> where you want to place the search box, then copy a page template like single.php and name it results.php then edit it and add <?php display_gsc_results(); ?>

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #82130
     cityofbuckeye
    Participant

    Hello Laura –

    Thank you for the speedy response. I haven’t had much success utilizing plugins. As a result, I am attempting to hard code the google custom search into the site.

    I would ultimately like user to be able to hover over the search icon and type in a search query as it currently exist (see attached image) on the theme but use Google Custom Search to provide results? Is it possible you could assist by telling me WHERE to add the following code in my header.php file?
    ______________________________________________________________________________________________
    Instructions from Google Custom Search:

    Copy the following code, and paste it into a <div> element in your site’s <body> section, where you want the search box to render.

    Note: For the most cross-browser compatibility, it is recommended that your HTML pages use a supported doctype such as <!DOCTYPE html>. CSS hover effects require a supported doctype.

    <script>
    (function() {
    var cx = ‘010288930059507962473:mk17zrzx1e0’;
    var gcse = document.createElement(‘script’);
    gcse.type = ‘text/javascript’;
    gcse.async = true;
    gcse.src = (document.location.protocol == ‘https:’ ? ‘https:’ : ‘http:’) +
    ‘//cse.google.com/cse.js?cx=’ + cx;
    var s = document.getElementsByTagName(‘script’)[0];
    s.parentNode.insertBefore(gcse, s);
    })();
    </script>
    <gcse:searchbox></gcse:searchbox>
    ________________________________________________________________________________________________________

    Sorry, I cant seem to figure it out for the life of me.

    Thank you in advance

    Attachments:
    You must be logged in to view attached files.
    #82132
     cityofbuckeye
    Participant

    Forgot to attach this. Thanks,

    Attachments:
    You must be logged in to view attached files.
    #82497
     Laura
    Moderator

    Hello, could you share ftp credentials so i can try to add it for you? 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #82581
     cityofbuckeye
    Participant

    Hi Laura – I am happy to provide ftp credentials but I don’t want that information to be public on the forum. Can you provide an email account I could send it to? My understanding is that all tickets are public on the forum?

    Thanks,

    #82582
     cityofbuckeye
    Participant
    This reply has been set as private.
    #82807
     Laura
    Moderator

    Hello, your test is private, you can go ahead and post your ftp credentials 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #83187
     cityofbuckeye
    Participant
    This reply has been set as private.
    #83277
     Laura
    Moderator

    Hello, please add this to style.css

    COPY CODE
    
    li#nav-menu-item-search {
        display: none;
    }
    

    This will hide the theme search as you already have the google one added to your menu, sadly to style it as the theme requires some extra development

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?