Skip to content

Instantly share code, notes, and snippets.

@rickrduncan
Last active December 25, 2015 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickrduncan/6927349 to your computer and use it in GitHub Desktop.
Save rickrduncan/6927349 to your computer and use it in GitHub Desktop.
Step 1: Google CSE for WordPress/Genesis Framework
<?php
//* Do NOT include the opening php tag above
add_filter( 'genesis_search_form', 'rvam_search_form', 10, 4);
function rvam_search_form( $form, $search_text, $button_text, $label ) {
$onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\"";
$onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\"";
$form = '<form method="get" class="searchform search-form" action="' . home_url() . '/search" >' . $label . '
<input type="text" value="' . esc_attr( $search_text ) . '" name="q" class="s search-input"' . $onfocus . $onblur . ' />
<input type="submit" class="searchsubmit search-submit" value="' . esc_attr( $button_text ) . '" />
</form>';
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment