[Support request] Replace search, but keep icon.

Home Forums Support [Support request] Replace search, but keep icon.

Home Forums Support Replace search, but keep icon.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #755176
    Visual D

    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

    #755834
    Tom
    Lead Developer
    Lead Developer

    Hi there,

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

    #755981
    Visual D

    Hi Tom

    https://maproducts.com.au/new-website/shop/

    Left side bar (search in the top)

    #756132
    Tom
    Lead Developer
    Lead Developer

    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' )
        );
    } );
    #756143
    Visual D

    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' )
        );
    } );
    ?>
    #756424
    David
    Staff
    Customer Support

    Hi there,

    that code won’t work in the Hooks Element. Try either of the methods provided here:

    https://docs.generatepress.com/article/adding-php/

    #757097
    Visual D

    Hi David

    No, that didn’t work either

    #757102
    Tom
    Lead Developer
    Lead Developer

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

    #757111
    Visual D

    Hi Tom

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

    #757114
    Tom
    Lead Developer
    Lead Developer

    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.

    #757118
    Visual D

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

    #757124
    Tom
    Lead Developer
    Lead Developer

    No problem – hopefully they have a solution we can implement 🙂

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.