Created
January 4, 2013 21:34
-
-
Save astockwell/4456409 to your computer and use it in GitHub Desktop.
Google Custom Search v2 Include Code for Wordpress - WORKING
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<section> | |
<!-- Put the following javascript before the closing </head> tag. --> | |
<script> | |
(function() { | |
var cx = '000000000000000000000:aaa1aa1aa1a'; | |
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; | |
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + | |
'//www.google.com/cse/cse.js?cx=' + cx; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); | |
})(); | |
</script> | |
<!-- Place this tag where you want the search results to render --> | |
<gcse:searchresults-only linktarget="_parent" queryParameterName="s"></gcse:searchresults-only> | |
</section> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment