Adding Google custom search
-
I want to add Google custom search to my free blog ‘https://islamic1articles.home.blog’. However, when I paste the snippet (below) in the ‘HTML widget’, the search box is not displayed. But only displays the code (below). What should I do
(function() {
var cx = ‘010238550591688396943:gbsocfzmbk8’;
var gcse = document.createElement(‘script’);
gcse.type = ‘text/javascript’;
gcse.async = true;
gcse.src = ‘https://cse.google.com/cse.js?cx=’ + cx;
var s = document.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(gcse, s);
})();The blog I need help with is: (visible only to logged in users)
-
You cannot insert code in a wordpress.com website or blog. If you write some code or copy-and-paste from another site, and then it disappears after publishing the post, the code is likely being stripped out as a security precaution, https://en.support.wordpress.com/code/.
An alternative is Jetpack Search, https://en.support.wordpress.com/wordpress-editor/blocks/jetpack-search/
- The topic ‘Adding Google custom search’ is closed to new replies.