Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
508 Compliant Genesis Search Box
<?php
//* Do NOT include the opening php tag
/** 508 Compliant Search Box
* @param string search form
* @param string search text
* @param string button text
* @return string modified search form
*/
function b3m_search_form( $form, $search_text, $button_text ) {
$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() . '/" >
<label class="s" for="s"><h4 class="widget-title widgettitle"><span class="sidebar-title">Site Search</span></h4></label>
<input id="s" type="search" value="' . esc_attr( $search_text ) . '" name="s" class="s search-input"' . $onfocus . $onblur . ' />
<input type="submit" class="searchsubmit search-submit" value="' . esc_attr( $button_text ) . '" />
</form>';
return $form;
}
add_filter( 'genesis_search_form', 'b3m_search_form', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment