Site logo

Archived topic

Replace search, but keep icon.

11 replies · Started by Edwin on December 12, 2018

Viewing posts 1–12 of 12

Hi

Is there a way to have a custom search with the default search icon in the menu?

Using Woo search

<?php if ( function_exists( 'aws_get_search_form' ) ) { aws_get_search_form(); } ?>

Thanks

Edwin

Hi there,

Is there an example of what that function outputs I can look at? Are you using it on your site anywhere?

Not 100% sure it will work, but try this:

add_filter( 'generate_navigation_search_output', function() {
    printf( 
        '<form method="get" class="search-form navigation-search" action="%1$s">
            <div class="aws-wrapper">
                <input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />

                <input type="hidden" name="post_type" value="product">
                <input type="hidden" name="type_aws" value="true">
                <div class="aws-search-clear"><span aria-label="Clear Search">×</span></div>
                <div class="aws-loader"></div>
            </div>
        </form>',
        esc_url( home_url( '/' ) ),
        esc_attr( get_search_query() ),
        esc_attr_x( 'Search', 'label', 'generatepress' )
    );
} );

Thanks Tom

Unfortunately that dint work.

Created Element/Hook show in every page ( wp_head) Execute PHP)


<?php
add_filter( 'generate_navigation_search_output', function() {
    printf( 
        '<form method="get" class="search-form navigation-search" action="%1$s">
            <div class="aws-wrapper">
                <input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />

                <input type="hidden" name="post_type" value="product">
                <input type="hidden" name="type_aws" value="true">
                <div class="aws-search-clear"><span aria-label="Clear Search">×</span></div>
                <div class="aws-loader"></div>
            </div>
        </form>',
        esc_url( home_url( '/' ) ),
        esc_attr( get_search_query() ),
        esc_attr_x( 'Search', 'label', 'generatepress' )
    );
} );
?>

Hi David

No, that didn't work either

Is the code still active? I'm not seeing the necessary elements on your site.

Hi Tom

Try Now, i disabled the child theme to check something before.

Hmm, in that case, it's likely that the widget is relying on something internal.

Might be worth asking the plugin author if it's possible to extend its functionality to another form on the site.

Thanks Tom. Will try to contact plugin developer
Appreciated your help as always.

No problem - hopefully they have a solution we can implement :)

This archived topic is closed to new replies.