Skip to content

Instantly share code, notes, and snippets.

@AMNDesign
Created August 27, 2013 21:54

Revisions

  1. AMNDesign created this gist Aug 27, 2013.
    21 changes: 21 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?php
    //* Customize Search Text
    add_filter( 'genesis_search_text', 'amn_search_text');
    function amn_search_text() {
    return esc_attr__( 'Search this website...', 'genesis' );
    }

    //* Customize Search Form
    add_filter( 'genesis_search_form', 'amn_search_form', 10, 4);
    function amn_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;
    }