从搜索栏html替换水印文本
I would like to change watermark text and pup-up text on my search bar.
Search box looks like on image bellow - I would like to change "Search ..." and "Search for:" texts:
Search box code from searchform.php :
<div class="search-wrapper">
<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label>
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label', 'Tesseract' ) ?></span>
<input type="search" class="search-field placeholdit" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'Tesseract' ) ?>" />
</label>
<input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'Tesseract' ) ?>" />
</form>
I find out that replacing "Search for:" changes the pop-up text but how to change watermark text?
我想在搜索栏上更改水印文字和傀儡文字。 p>
搜索框如下图所示 - 我想更改“搜索...”和“搜索:”文本: p>
p>
searchform.php中的搜索框代码: p>
&lt; div class =“search- 包装器“&gt;
&lt; form role =”search“method =”get“class =”search-form“action =”&lt;?php echo esc_url(home_url('/'));?&gt;“&gt ;
&lt; label&gt;
&lt; span class =“screen-reader-text”&gt;&lt;?php echo _x('搜索:','标签','Tesseract')?&gt; ;&LT; /跨度&GT;
&lt; input type =“search”class =“search-field placeholdit”value =“&lt;?php echo get_search_query()?&gt;” name =“s”title =“&lt;?php echo esc_attr_x('Search for:','label','Tesseract')?&gt;” /&gt;
&lt; / label&gt;
&lt; input type =“submit”class =“search-submit”value =“&lt;?php echo esc_attr_x('Search','submit button', 'Tesseract')?&gt;“ /&gt;
&lt; / form&gt;
code> pre>
p>
我发现更换“搜索:”更改 弹出文本,但如何更改水印文本? p>
div>
You could try add placeholder="New text"
to input type="search"
element.
Additionally you could lookup whether you have some additional javascript that reacts with the element or its class (e.g. with class placeholdit
).
Replace value="<?php echo get_search_query() ?>"
with what you want.
You mean by "watermark" you mean the Search ...
text?