目前,我正在使用未过滤的MU插件运行Wordpress MU博客。然而,当我尝试插入HTML5标记时,它会被剥离。我相信可能是WYSIWYG编辑器在清理代码。在哪里可以更改设置以允许?
谢谢
目前,我正在使用未过滤的MU插件运行Wordpress MU博客。然而,当我尝试插入HTML5标记时,它会被剥离。我相信可能是WYSIWYG编辑器在清理代码。在哪里可以更改设置以允许?
谢谢
仅供参考。。。WordPress 3.2包括一个更新的TinyMCE,它允许HTML5标记。它仍在开发中,但如果您现在想冒险运行它,它是相当稳定的。
另一种方法是在关闭可视化编辑器的情况下编写任何需要标记的帖子。只要你不在同一篇文章上再次打开编辑器,标签就会留在那里。只要打开编辑器,一旦你离开了管理中的帖子。
尝试此操作以允许不允许的标记。。。http://tierra-innovation.com/wordpress-cms/plugins/extend-kses/
这是完全未经测试的,但我很确定我刚才为您编写的这个短代码插件会起作用。你可能需要调整一下。请让我知道任何一种方式。
短码:[videotag option1="value1" option2="value2"]
例子:[videotag src="http://path.com/to/video.mp4" height="400" width="300" controls="controls"]
<?php
/*
Plugin Name: Add \'videotag\' shortcode
Plugin URI: http://wordpress.stackexchange.com/questions/12059/how-to-allow-video-html5-tag-in-wordpress
Description: Adds support for <video> HTML tag described here: http://diveintohtml5.org/video.html
Supports the attributes described here: http://www.w3schools.com/html5/tag_video.asp (warning: http://w3fools.com/)
Author: http://wordpress.stackexchange.com/users/1860/
*/
function build_video_tag_html_embed($atts, $content = null) {
extract( shortcode_atts( array(\'audio\'=>\'\',
\'autoplay\'=>\'\',
\'controls\'=>\'\',
\'height\'=>\'\',
\'loop\'=>\'\',
\'poster\'=>\'\',
\'preload\'=>\'\',
\'src\'=>\'\',
\'text\'=>\'This browser doesn\\\'t support the <pre><video></pre> tag.\',
\'width\'=>\'\'), $atts));
/* Sanitize some stuff */
$text = sanitize_text_field($text);
$width = intval($width);
$height = intval($height);
$html_to_return .= "<video";
if( !empty($audio) ) {
$html_to_return .= " audio=\'" . esc_attr($audio) . "\'";
}
if( !empty($autoplay) ) {
$html_to_return .= " autoplay=\'" . esc_attr($autoplay) . "\'";
}
if( !empty($controls) ) {
$html_to_return .= " controls=\'" . esc_attr($controls) . "\'";
}
if( !empty($height) ) {
$html_to_return .= " height=\'" . esc_attr($height) . "\'";
}
if( !empty($loop) ) {
$html_to_return .= " loop=\'" . esc_attr($loop) . "\'";
}
if( !empty($poster) ) {
$html_to_return .= " poster=\'" . esc_attr($poster) . "\'";
}
if( !empty($preload) ) {
$html_to_return .= " preload=\'" . esc_attr($preload) . "\'";
}
if( !empty($src) ) {
$html_to_return .= " src=\'" . esc_attr($src) . "\'";
}
if( !empty($width) ) {
$html_to_return .= " width=\'" . esc_attr($width) . "\'";
}
$html_to_return .= ">{$text}</video>";
}
add_shortcode(\'videotag\', \'build_video_tag_html_embed\');
?>
有趣的问题。这将是一个很好的补丁,也许是我将提交的第一个补丁。我如何创建一个列表,只显示我的网站最常用的十个标签?有点像Delicious组织标签的方式。有什么想法吗?