Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Replace genesis_search_form function for inclusion of adsense code
- // Change partner-pub numeric to agree with adsense account
- add_filter( 'get_search_form', 'custom_adsense_search_form' );
- /*** Replace the default search form with a Adsense-specific form. **/
- function custom_adsense_search_form() {
- $search_text = get_search_query() ? esc_attr( apply_filters( 'the_search_query', get_search_query() ) ) : apply_filters( 'genesis_search_text', esc_attr__( 'Search this website', 'genesis' ) . '…' );
- $button_text = apply_filters( 'genesis_search_button_text', esc_attr__( 'Search', 'genesis' ) );
- $onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\"";
- $onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\"";
- /** Empty label, by default. Filterable. */
- $label = apply_filters( 'genesis_search_form_label', '' );
- $form = '
- <form method="get" class="searchform search-form" action="http://www.google.com.au/cse" id="cse-search-box" target="_blank" />
- ' . $label . '
- <input type="hidden" name="cx" value="partner-pub-0000000000000000:zghc4b-vsqt" />
- <input type="hidden" name="ie" value="ISO-8859-1" />
- <input type="text" value="' . esc_attr( $search_text ) . '" name="s" class="s search-input"' . $onfocus . $onblur . ' />
- <input type="submit" name="sa" class="searchsubmit search-submit" value="' . esc_attr( $button_text ) . '" />
- </form>
- <script type="text/javascript" src="http://www.google.com.au/cse/brand?form=cse-search-box&lang=en"></script>
- ';
- return apply_filters( 'custom_adsense_search_form', $form, $search_text, $button_text, $label );
- }
Advertisement
Add Comment
Please, Sign In to add comment