Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    It looks like only query and category params are not working, this is some kind of conflict with your theme you should be able to fix it by:

    1. add in your theme functions.php file the code below

    
    add_filter( "adverts_form_load", "change_query_field_name" );
    function change_query_field_name( $form ) {
      if( $form['name'] != "search" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "query" ) {
            $form["field"][$key]["name"] = "ad_query";
        }
      }
      return $form;
    }
    add_filter( "adverts_list_query", function( $args ) {
      if( adverts_request( "ad_query" ) ) {
        $args["s"] = adverts_request( "ad_query" );
      }
      return $args;
    });
    

    2. edit the search-by-category.php snippet and on line 28, 54, 62 change advert_category to ad_category.

    Thread Starter crististan

    (@crististan)

    Where I find the search-by-category.php snippet?

    Plugin Author Greg Winiarski

    (@gwin)

    It depends on how you have it added on site, usually, it should be in wp-admin / Plugins panel (in the file system that would be wp-content/plugins/search-by-category) or the code can be copied and pasted in your theme functions.php file.

    Unless you have the Category field added using Custom Fields extension, then the code will not be anywhere, and you will just need to rename the Category field using Custom Fields editor.

    Thread Starter crististan

    (@crististan)

    Ok, thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search form not working’ is closed to new replies.