我真的很喜欢你如何将URL粘贴到帖子中。。。例如:
http://youtube.com/watch?v=xyz
或http://vimeo.com/123456
我要做的是更改此的默认代码,以支持此处的代码:http://embedresponsively.com/
我在函数中假设,如何覆盖youtube和vimeo代码。php莫名其妙?
我真的很喜欢你如何将URL粘贴到帖子中。。。例如:
http://youtube.com/watch?v=xyz
或http://vimeo.com/123456
我要做的是更改此的默认代码,以支持此处的代码:http://embedresponsively.com/
我在函数中假设,如何覆盖youtube和vimeo代码。php莫名其妙?
仔细看一下该网站上提供的代码,它与WordPress默认输出的主要区别如下:
iframe用div包装,div的类为embed-container
add_filter(\'embed_oembed_html\', \'my_embed_oembed_html\', 99, 4);
function my_embed_oembed_html($html, $url, $attr, $post_id) {
return \'<div class="embed-container">\' . $html . \'</div>\';
}
并添加由http://embedresponsively.com/ 主题:.embed-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
max-width: 100%;
height: auto;
}
.embed-container iframe, .embed-container object, .embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
我测试了过滤器,效果很好。我没有测试CSS,这将由你来决定。过滤器的来源:http://wordpress.org/support/topic/adding-a-wrapping-div-to-video-embeds?replies=2
我已经设置了一个名为cpt\\u top\\u ten\\u list的自定义帖子类型。我正在尝试设置一个页面来显示所有自定义帖子类型。我把我的新页面命名为前十页。并在页面顶部添加了一个模板标记。在仪表板中创建了一个名为“前十名列表”的页面,并将该页面分配给了我的新模板。现在,当我转到页面时,它似乎会将我重定向到自定义帖子类型的归档页面。如果我关闭cpt的存档功能,它会将我重定向到第页。php。如果我添加flush_rewrite_rules(); 转换为函数。php,我的新自定义页面可以工作,但其他页面