我有一个主题表单 yootheme pro,我在 searchform.php 上有以下代码:
<?php
/**
* The template for displaying a search form.
*/
$result = get_view('search', [
'position' => get_current_sidebar(),
'attrs' => [
'id' => 'search-'.rand(100, 999),
'action' => esc_url(home_url('/')),
'method' => 'get',
'role' => 'search',
'class' => '',
],
'fields' => [
['tag' => 'input', 'name' => 's', 'placeholder' => esc_attr_x('Search …', 'placeholder'), 'value' => get_search_query()], 'name' => get_post_type()]
]
]);
if ($echo) {
echo $result;
} else {
return $result;
}
我跪下来修改这个编码并将 &post_type=product 添加到结果 url
谢谢