/** * If the Google Custom Search widget is active, then render the JavaScript necessary for the widget * in the header of the page. * * @version 1.0.0 * @since 3.4.0 */ function standard_google_custom_search() { if (standard_google_custom_search_is_active()) { $gcse = get_option('widget_standard-google-custom-search'); $gcse = array_shift(array_values($gcse)); ?> <script type="text/javascript"> (function() { var cx = '<?php echo trim($gcse['gcse_content']); ?> '; 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> <?php } // end if }
?> <?php } // end if ?> <div id="main" class="<?php echo 'full_width_layout' == $presentation_options['layout'] ? 'span12 fullwidth' : 'span8'; ?> clearfix" role="main"> <?php // Even if google custom search is active, we may be coming from the 4040 page so we'll run this template. ?> <?php if (!standard_google_custom_search_is_active() || '' != get_query_var('s')) { ?> <?php get_template_part('breadcrumbs'); ?> <div id="search-page-title"> <h3><?php _e('Search Results For "', 'standard'); echo get_query_var('s'); _e('"', 'standard'); ?> </h3> </div>
(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <?php } // end if/else ?> <?php } // end if ?> <?php if (standard_google_custom_search_is_active()) { ?> <?php $gcse = get_option('widget_standard-google-custom-search'); ?> <?php $gcse = array_shift(array_values($gcse)); ?> <script type="text/javascript"> (function() { var cx = '<?php echo trim($gcse['gcse_content']); ?> '; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
/** * Determine which search form to display based on if the author has enabled * Google Custom Search Widget activated. * * @since 3.0 * @version 3.2 */ function standard_get_search_form() { // First, detect if the Google Custom Search widget is active if (standard_google_custom_search_is_active()) { // Read the author's Google Search Engine ID. If they have multiple instances, // then we need to read the most recent instance of the widget. $gcse = get_option('widget_standard-google-custom-search'); $gcse = array_shift(array_values($gcse)); // Programmatically create the widget $o = new Google_Custom_Search(); $o->widget(array('before_widget' => '', 'after_widget' => ''), array('gcse_content' => trim($gcse['gcse_content']))); // Otherwise, display the default search form } else { get_search_form(); } // end if }