问题描述
我正在使用最新的Wordpress 4.9.6.我正在尝试使用来自media-audio.php帖子格式文件中的wp_audio_shortcode向其中一个帖子添加一些音频.
I am using the latest Wordpress 4.9.6. I am trying to add some audio to one of my posts using the wp_audio_shortcode from my media-audio.php post format file.
我确实设法播放音频,但是我真的不喜欢以某种方式添加的mejs-mediaelement播放器.我实际上想完全删除此播放器,并使用显示的默认代码:
I do manage to play the audio, but I do not really like the mejs-mediaelement player that somehow gets added. I actually want to completely remove this player and use the default code that appears:
<audio class="wp-audio-shortcode" id="audio-329-1" preload="none" style="width: 100%;" controls="controls"><source type="audio/mpeg" src="https://www.example.com/wp-content/uploads/2018/06/preview-1.m4a?_=1"><a href="https://www.example.com/wp-content/uploads/2018/06/preview-1.m4a">https://www.example.com/wp-content/uploads/2018/06/preview-1.m4a</a></audio>
如何关闭/禁用wp_audio_shortcode添加的mejs-mediaelement播放器?
推荐答案
如果要完全禁用它,请使用 wp_audio_shortcode_library
挂钩可防止媒体/播放器库的CSS和JS文件排队/加载:
If you want to completely disable it, then use the wp_audio_shortcode_library
hook to prevent the media / player library's CSS and JS files from being queued/loaded:
add_filter( 'wp_audio_shortcode_library', '__return_empty_string' );
或者,不禁用该库,而仅禁用或替换默认的CSS类名:([audio]
短代码的 default 媒体库JS/script仅针对具有以下内容的HTML元素wp-audio-shortcode
类)
Alternatively, don't disable the library, but disable or replace only the default CSS class name: (the default media library JS/script for the [audio]
Shortcode is targeting only HTML elements with the wp-audio-shortcode
class)
add_filter( 'wp_audio_shortcode_class', '__return_empty_string' );
这篇关于使用wp_audio_shortcode的Wordpress音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!