php - Wordpress 简码 AMP 绑定不起作用
问题描述
我在 html 文件上进行了测试,它可以工作。
<div hidden
[hidden]="hideGreeting">Hello World</div>
<button on="tap:AMP.setState({ hideGreeting: false })">Show greeting</button>
<button on='tap:AMP.setState({ text:"testing"})'>Testing Btn</button>
<input type="text" [value]="text1" />
但是我将此代码添加为 wordpress 短代码,并且删除了[value]属性。
仅供参考,第一个按钮有效,但第二个输入标签无效。
Wordpress 短代码在这里。
function test_shortcode_func( $atts, $content = null ) {
$html .= '<div><div hidden [hidden]="hideGreeting">Hello World</div><button on="tap:AMP.setState({ hideGreeting: false })">Show greeting</button></div>';
$html .= '<button on=\'tap:AMP.setState({ text1:"testing"})\'>Testing Btn</button><input type="text" value [value]="text1" />';
return $html;
}
add_shortcode('test_shortcode' , 'test_shortcode_func');