Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #193498

    Hi
    The plugin developer/support tells me that if I want to use the WooCommerce Predictive Search, to show in the theme header, and to replace the exist theme search function (which I think is the basic WordPress search), I need to add the following code to the file that contains the search function.

    <?php
    $ps_echo = true ;
    if ( function_exists( ‘woo_predictive_search_widget’ ) ) woo_predictive_search_widget( $ps_echo );
    ?>

    I’m not a php developer, so I need help in identifying in which file do I add this code, header.php or search.php or searchform.php?

    The previous ticket opened on this issue never resolved my problem.

    I’m curious, have others used a different search plugin to replace the basic WordPress search function in any of your themes? We they successful?

    Thanks
    Lyse

    #193669

    I have used a predictive search plugin in the past with abundance and it worked. It was a few years back though so I don’t remember which plugin it was but it’s possible, it works.
    Just wait for an answer from the support guys and you’ll get it fixed I’m sure.

    #193674

    Hi!

    Try putting it in searchform.php.

    Cheers!
    Josue

    #193908

    Hi Josue,

    That did not work. and I’ve lost my search form box – it’s no longer displaying. I only see the loop image.

    Lyse

    #193918

    Hi Josue,

    I had a syntax error in my searchform.php. Now I see the search box. However, this file does not appear to be the one to make this work, unless I don’t know exactly what code to replace or where exactly to insert the Predictive Search code in that file.

    Thanks,
    Lyse

    #193928

    Hi!

    Personally I’d recommend to replace the default search icon with the search form. Revert the changes in searchform.php and in functions-enfold.php replace

    
    	    if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu"))
    	    {
    	        global $avia_config;
    	        ob_start();
    	        get_search_form();
    	        $form =  htmlspecialchars(ob_get_clean()) ;
    
    	        $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown"><a href="?s=" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'></a></li>';
    	    }
    

    with

    
    if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu"))
    {
    	        global $avia_config;
    	       if (function_exists('woo_predictive_search_widget')) {
    	       	    $searchform = woo_predictive_search_widget(false);
    	       	    $items .= '<li class="menu-item">'. $searchform .'</li>';
    	      }
    }
    

    Best regards,
    Peter

    #193929

    Hi Peter,

    I don’t have a functions-enfold.php, my theme is Abundance.

    Lyse

    #195217

    Hi!

    Yes mea culpa – I thought you’re using Enfold. If you’re using Abundance open up header.php and replace

    
    get_search_form();
    

    with

    
    if(function_exists('woo_predictive_search_widget')) woo_predictive_search_widget(true);
    

    Cheers!
    Peter

    #197714

    Hi Peter
    I added the code to my header.php, however the search box not longer shows.
    I retracted the code from the header.php for now because I launch Dec 11th.
    In the meantime I’ll be testing the recommended changes in my staging/development area so I will not affect the live site.

    Thanks
    Lyse

    #197962

    Hey!

    In this case I recommend to contact the plugin author. Based on the code you gave us here http://www.kriesi.at/support/topic/predictive-search-plugin/#post-193498 it should work. If it doesn’t we maybe miss something and I guess it’s better to contact the developer who is more familiar with the plugin code.

    Cheers!
    Peter

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.