I’m not seeing how the link you included would help me modify the existing search so that it looks at adverts_person
in addition to what it’s already searching.
I don’t see where it indicates what fields it’s searching (which seem to be just title and description). Are they being added to the visible group somewhere and that’s how it’s controlled? Or is there another place where this is set?
Any direction you could provide would be very much appreciated.
I see the default search form info in defaults.php:
// Set default search form in [adverts_list] shortcode
Adverts::instance()->set("form_search", array(
"name" => "search",
"action" => "",
"field" => array(
array(
"name" => "query",
"type" => "adverts_field_text",
"label" => "",
"order" => 10,
"placeholder" => __("Keyword ...", "adverts"),
"meta" => array(
"search_group" => "visible",
"search_type" => "half"
)
),
array(
"name" => "location",
"type" => "adverts_field_text",
"label" => "",
"order" => 10,
"placeholder" => __("Location ...", "adverts"),
"meta" => array(
"search_group" => "visible",
"search_type" => "half"
)
)
)
));
It feels like I need to add to that a bit.
Okay, with a little more exploration, I found your snippets for search by price, date, and category. I created a new plugin for search by name — almost there, but not quite. Can you help me with some of the key variables for this? For example, am I missing anything in this section?
$form['field'][] = array(
"name" => "adverts_person",
"type" => "adverts_field_text",
"order" => 20,
"label" => __("Member Name"),
"meta" => array(
"search_group" => "visible",
"search_type" => "half"
)
);
And are the names right in this?
function search_by_name_query( $args ) {
if( ! adverts_request( "adverts_person" ) ) {
return $args;
}
$args["tax_query"] = array(
array(
'taxonomy' => 'adverts_person',
'field' => 'term_id',
'terms' => adverts_request( "adverts_person" ),
),
);
return $args;
}
The field is showing up under the Keyword… field on my page, but text typed into the field doesn’t get recognized/produce in any results. I feel like I’m close!! I don’t think I have something right to search the list of people who have ads posted.
Thanks again.