Feb 9, 2020
Why is my Google CSE search icon in the header for chrome on mobile not working?
Unfortunately, I could not find anything related to my topic over the internet. I am a beginner and have tried to figure it out but I have no clue where to start or where to look.
I want to mention that I use WordPress and set up Google CSE with the Layout set to Compact using their Default Theme and have added CSS to style the search box and results. I have run several tests and only one result prevailed. Also, one thing I want to note in doing all of my tests is I cleared my cache via browser and Supercacher for my website. The first test was to deactivate all plugins and that did not change anything. The second step was to delete the CSS I added and that did nothing. Then, I changed the theme and that worked. Our theme, BuddyBoss, has a search.php file and a searchform.php file. The theme I switched to only has a searchform.php file (not sure if that matters at all). I deleted the PHP in the searchform.php file and added the following code (using my Child Theme):
(function() {
var cx = 'CSE ID';
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-only resultsUrl="https://www.example.com/"></gcse:searchbox-only>
If any of you need a copy of the CSS I implemented, just let me know.
Is there some type of code I can put in to fix this issue or is it something else? I understand that this may be a little more complex, so I appreciate the time you give me as well as any help I get. Hopefully, it will be an easy thing to fix. If not, any direction anyone can give me would be greatly appreciated!
I hope I was clear, easy to follow, and answered all of your questions. Thank you!
Thanks and regards,
Josh
I hope I was clear, easy to follow, and answered all of your questions. Thank you!
Thanks and regards,
Josh
Community content may not be verified or up-to-date. Learn more.
Last edited Feb 9, 2020
All Replies (5)