更改店面搜索字段的占位符

时间:2019-07-09 02:53:32

标签: search woocommerce placeholder storefront

,谢谢。 注意:NSFW网站上,也许有一些来自电子书封面的热门图片,没有裸体,但有成人浪漫情结。

好,

我有WP + storefront + bookshop子主题,我想在搜索字段(#woocommerce-product-search-field-0)内更改占位符“ Search products…”。不管我尝试什么,似乎都不会影响占位符。

我可以更改搜索宽度,对齐方式,文本和边框颜色,但不能使用占位符… 到目前为止,这里的代码

> /*Align Search Bar and make text and border pink #fe00a1*/
> #woocommerce-product-search-field-0 { display:inline-block; width:100%; color: #fe00a1; border: solid 1px #fe00a1; }

我还尝试了多个PHP代码段,使我能够在woocommerce中更改几乎所有文本的最好的代码段是此GETTEXT过滤器

> function my_text_strings( $translated_text, $text, $domain ) { switch
> ( $translated_text ) { case ‘Search products…’ : $translated_text =
> __( ‘Search for contemporary romance books, series ot authors…’, ‘woocommerce’ ); break; } return $translated_text; } add_filter(
> ‘gettext’, ‘my_text_strings’, 20, 3 );

但是..是的,你猜对了,它没用。

如何用“搜索当代浪漫书籍,系列或作者……”替换锁定,隐藏或带有“搜索产品”的内容? CSS,PHP,一些技巧?

谢谢。

1 个答案:

答案 0 :(得分:0)

好的,这是解决方案,感谢wordpress.org的@jobthomas

    menu.addAction(QAction("Quit", menu))