-
Author
Tagged: google search
-
September 18, 2015 at 19:25 #78404cityofbuckeyeParticipant
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.
September 19, 2015 at 21:09 #78525LauraModeratorHello, 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 solutionLaura 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 🙂
October 13, 2015 at 21:56 #82130cityofbuckeyeParticipantHello 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.October 13, 2015 at 21:57 #82132cityofbuckeyeParticipantForgot to attach this. Thanks,
Attachments:
You must be logged in to view attached files.October 15, 2015 at 20:40 #82497LauraModeratorHello, 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 solutionLaura 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 🙂
October 16, 2015 at 02:23 #82581cityofbuckeyeParticipantHi 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,
October 16, 2015 at 22:22 #82807LauraModeratorHello, 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 solutionLaura 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 🙂
October 19, 2015 at 22:31 #83277LauraModeratorHello, please add this to style.css
COPY CODEli#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 solutionLaura 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 🙂
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.