Avada Forums Community Forum Replace search form with shortcode

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • pepperstreetuk
    Participant
    Post count: 3

    Hi, I am trying to replace the avada search function with the woocommerce dynamic search. The shortcode is this [woocommerce_product_search]. I’m not a PHP developer by I can muddle by. Does anyone know where the code is for the search? And if so how to add in the shortcode rather than calling the default form?
    I tried this in my functions.php

    /** SEARCH TOP NAV MENU */

    function head_nav_search($items, $args) {
    if( !($args->theme_location == ‘top_navigation’) )
    return $items;
    return $items . ‘

  • ‘ . get_search_form(false) . ‘
  • ‘;

    }
    add_filter(‘wp_nav_menu_items’, ‘head_nav_search’, 10, 2);

    Which calls the default search and puts it in my top secondary nav, which would do if I can’t get it in the actual search box but now instead of get_search_form(false) I want to call the shortcode but have reached the limits of my php knowledge. Any help greatly appreciated.