寻找一个PHP函数(非jQuery或wpautop修改)方法<p></p>从wordpress中删除.
我试过这个,但它不起作用:
function cleanup_shortcode_fix($content) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']',
']<br>' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'cleanup_shortcode_fix');
Run Code Online (Sandbox Code Playgroud) 编辑:我在Wordpress方面发布了这个,但有些管理员认为它在这里是因为他们说这是客户端问题,但我不认为这是因为他的脚本工作原样(在非wordpress网站)但只抛出在Wordpress站点上仅在某些浏览器上使用脚本时出现DOM异常11错误.相同的脚本在Wordpress下运行,但仅在Chrome上运行.
当锚链接悬停并将其转换为Wordpress插件时,我已经采用了播放音频剪辑的脚本.
它工作正常,但仅适用于Chrome(Mac).在Firefox或Safari(当前版本)上,脚本会抛出DOM错误.
这是错误:
INVALID_STATE_ERR:DOM异常11:尝试使用不可用或不再可用的对象.
产生错误的行是: html5audio.currentTime=0
以下脚本适用于我在非Wordpress网站上遇到问题的浏览器.http://www.javascriptkit.com/script/script2/soundlink.shtml#current
我已经尝试过研究这个问题并使用一些修复但我无法开始工作.
var html5_audiotypes={
"mp3": "audio/mpeg",
"mp4": "audio/mp4",
"ogg": "audio/ogg",
"wav": "audio/wav"
}
function audio(sound){
var html5audio=document.createElement('audio')
if (html5audio.canPlayType){ //check support for HTML5 audio
for (var i=0; i<arguments.length; i++){
var sourceel=document.createElement('source')
sourceel.setAttribute('src', arguments[i])
if (arguments[i].match(/\.(\w+)$/i))
sourceel.setAttribute('type', html5_audiotypes[RegExp.$1])
html5audio.appendChild(sourceel)
}
html5audio.load()
html5audio.playclip=function(){
html5audio.pause()
html5audio.currentTime=0
html5audio.play()
}
return html5audio
}
}
Run Code Online (Sandbox Code Playgroud) 我已经阅读了API文档,但我迷失了.
我想做的就是从私人视频中获取缩略图.
我没有构建应用程序,但要获得我需要的密钥,我必须包含应用程序的网站,徽标和应用程序的返回URL.
我再次需要一个缩略图.
我不是API的新手,但我真的需要一些示例PHP代码来帮助我开始,以及如何设置应用程序来获取我需要的密钥.
根据我的理解,我应该使用oembed,这看起来很简单,但我需要帮助进行身份验证.
php ×2
audio ×1
function ×1
html5 ×1
javascript ×1
shortcode ×1
thumbnails ×1
vimeo ×1
vimeo-api ×1
wordpress ×1