Str 替换按钮的输入
Str replace for input to button
我正在尝试将 wordpress 搜索提交 <input type="submit">
按钮更改为 <button>
。所以我正在尝试使用 str_replace。这是我的代码:
add_filter('get_search_form', 'my_search_form_text');
function my_search_form_text($text) {
$text = str_replace(
'<input type="submit" class="search-submit" value="Search">',
'<button type="submit" class="search-submit btn btn-outline-primary"><i class="fas fa-search"></i></button>',
$text
);
return $text;
}
但是没用。
在您的主题文件夹中 searchform.php
文件存在。如果不从默认主题复制到您的主题。
此处将您的 <input>
替换为 <button>
我正在尝试将 wordpress 搜索提交 <input type="submit">
按钮更改为 <button>
。所以我正在尝试使用 str_replace。这是我的代码:
add_filter('get_search_form', 'my_search_form_text');
function my_search_form_text($text) {
$text = str_replace(
'<input type="submit" class="search-submit" value="Search">',
'<button type="submit" class="search-submit btn btn-outline-primary"><i class="fas fa-search"></i></button>',
$text
);
return $text;
}
但是没用。
在您的主题文件夹中 searchform.php
文件存在。如果不从默认主题复制到您的主题。
此处将您的 <input>
替换为 <button>