Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 删除Wordpress中的iframe标记_Php_Html_Wordpress - Fatal编程技术网

Php 删除Wordpress中的iframe标记

Php 删除Wordpress中的iframe标记,php,html,wordpress,Php,Html,Wordpress,我正在研究wordpress主题,WP现在使用oEmbed将已知链接自动转换为小部件。这里的问题是,小部件没有响应,它们没有保持相同的纵横比并根据屏幕大小进行调整 该网站是 请注意,我使用的主题是215的子主题。您可以在此处下载主题文件: 我做了一些研究,发现了这段视频: 在视频中,他删除了iframe的with和height属性。我的问题是这些标记是由oEmbedd自动添加的,因此我需要某种过滤器来删除/忽略iframe中的高度和宽度标记 我正在尝试更改iframe。更具体地说,我想通过使用

我正在研究wordpress主题,WP现在使用oEmbed将已知链接自动转换为小部件。这里的问题是,小部件没有响应,它们没有保持相同的纵横比并根据屏幕大小进行调整

该网站是 请注意,我使用的主题是215的子主题。您可以在此处下载主题文件:

我做了一些研究,发现了这段视频: 在视频中,他删除了iframe的with和height属性。我的问题是这些标记是由oEmbedd自动添加的,因此我需要某种过滤器来删除/忽略iframe中的高度和宽度标记

我正在尝试更改iframe。更具体地说,我想通过使用我认为是过滤器的东西来删除iframe的高度和宽度标签

例如: 我想改变这个

<iframe width="660" height="400" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?visual=true&amp;color=000000&amp;download=false&amp;show_user=false&amp;sharing=false&amp;show_comments=false&amp;show_playcount=false&amp;hide_related=true&amp;url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F192992432&amp;show_artwork=false&amp;&amp;"></iframe>
为此: 宽度=660高度=400已经消失

<iframe scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?visual=true&amp;color=000000&amp;download=false&amp;show_user=false&amp;sharing=false&amp;show_comments=false&amp;show_playcount=false&amp;hide_related=true&amp;url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F192992432&amp;show_artwork=false&amp;&amp;"></iframe>
我不熟悉php,很难找到我能理解的文章,所以如果可以,请帮助我。

尝试使用

function mycustom_embed_defaults($embed_size){ 
    // Applies for all embedded media 
    /*$embed_size['width'] = 827;*/ // Adjust the width of the player 
    // $embed_size['height'] = 120; // Adjust the height of the player 
    unset($embed_size['width']); 
    unset($embed_size['height']); 
    return $embed_size; // Return new size 
}


问题是你的插件似乎需要width属性。。。你所要做的就是知道你想要的是什么。。。它不必是像素值…

应定义或使用自动上一个建议$embed_size['width']=100%;对不起,我完全迷路了。我可能缺乏PHP的基本知识。我很想重新写一个问题,问我如何从iframe中删除高度和宽度属性,而不从iframe本身中删除这些值。也许从头开始更好。我认为最好从新问题开始,并尝试从头开始。我确实在每个php文件中查找了embed_默认值,但找不到它。这意味着我一定从一开始就搞砸了。我想我需要一些从零开始的帮助来正确设置php,对不起。谢谢你的帮助。如果你找不到它,那是因为它从来没有被调用过。事实上,你是不是自己用复制粘贴的FAQ来实现这个功能的?你可能错过了一部分,然后我可能错过了那一部分,是的。那我怎么称呼它呢?我的php技能很糟糕。
function mycustom_embed_defaults($embed_size){ 
    // Applies for all embedded media 
    $embed_size['width'] = "auto"; // Adjust the width of the player 
    $embed_size['height'] = "auto"; // Adjust the height of the player 
    return $embed_size; // Return new size 
}
function mycustom_embed_defaults($embed_size){ 
    // Applies for all embedded media 
    $embed_size['width'] = "100%"; // Adjust the width of the player 
    $embed_size['height'] = "100%"; // Adjust the height of the player 
    return $embed_size; // Return new size 
}