admin管理员组文章数量:1293670
I am trying to add onmouseover="this.play()" onmouseout="this.pause()"
to the default <video
element in Wordpress. I am using Gutenberg block editor.
By default, this is what the output from the video block looks like in HTML:
<video src=".mp4"></video>
I want it to be like this:
<video onmouseover="this.play()" onmouseout="this.pause()" src=".mp4"></video>
I want to add the onmouseover="this.play()" onmouseout="this.pause()"
to the default video element.
I have tried the below filter but it's not working:
add_filter( 'wp_video_shortcode', function( $output ) {
$output = str_replace( '<video', '<video onmouseover="this.play()" onmouseout="this.pause()"', $output );
return $output;
} );
Am I doing something wrong? Any help would be greatly appreciated.
Thanks.
本文标签: functionsCustomizing the wpvideoshortcode output with addfilter
版权声明:本文标题:functions - Customizing the wp_video_shortcode output with add_filter 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741577837a2386393.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论