所以,我认为我可以通过尝试应用
来改变这一点input#coupon_code.input-value::placeholder {
content: 'Enter Code here'; }
这是CSS并且它不起作用,所以我开始在php的
找到它的位置我设置了wordpress,所以我继续cart.php
和coupon.php
我根本不熟悉php环境,所以在浏览了所有内容30分钟后查看%$符号后我感到头晕目眩。
我目前只是试图找到如何更改此占位符文本,但无法这样做。
由于
答案 0 :(得分:2)
在WooCommerce或任何插件中更改文本的首选方法是使用gettext过滤器。最好使用过滤器而不是编辑模板,因为在更新WooCommerce时可以更改模板。将以下代码放在functions.php文件中,以获得更加面向未来的解决方案。
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Coupon code' :
$translated_text = __( 'My New Coupon Code Text', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );
答案 1 :(得分:-1)
让我们在 coupon.php 中说明您有以下内容:
<p class="form-row form-row-first">
<input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" />
</p>
更改placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>"
:
<p class="form-row form-row-first">
<input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'your placeholder text here', 'woocommerce' ); ?>" id="coupon_code" value="" />
</p>
您在此处看到占位符文字,这就是您更改它的位置。