如果您不想为短代码解决方案使用其他插件,您可以在主题、插件或函数中添加这些内容。php手动添加。如有必要,您可能需要向密钥数组添加更多密钥。
add_shortcode( \'iframe\' , \'mycustom_shortcode_iframe\' );
function mycustom_shortcode_iframe($args, $content) {
$keys = array("src", "width", "height", "scrolling", "marginwidth", "marginheight", "frameborder");
$arguments = mycustom_extract_shortcode_arguments($args, $keys);
return \'<iframe \' . $arguments . \'></iframe>\';
}
function mycustom_extract_shortcode_arguments($args, $keys) {
$result = "";
foreach ($keys as $key) {
if (isset($args[$key])) {
$result .= $key . \'="\' . $args[$key] . \'" \';
}
}
return $result;
}
然后在您的帖子页面中,用法如下:
[iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.de/maps?f=q&source=s_q&hl=de&geocode=&q=New+York+City,+New+York,+USA&aq=0&oq=new+york&sll=51.238455,6.81435&sspn=0.373151,1.056747&ie=UTF8&hq=&hnear=New+York+City,+New+York,+Vereinigte+Staaten&t=m&z=11&iwloc=A&output=embed"]