Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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
嵌入iframe的wordpress短代码每页只执行一次_Wordpress_Iframe_Shortcode - Fatal编程技术网

嵌入iframe的wordpress短代码每页只执行一次

嵌入iframe的wordpress短代码每页只执行一次,wordpress,iframe,shortcode,Wordpress,Iframe,Shortcode,我有以下wordpress短代码 function wiki_show( $atts ) { // Attributes $atts = shortcode_atts( array( 'name' => '', 'height' => '500', ), $atts, 'wiki' ); // Return custom embed c

我有以下wordpress短代码

function wiki_show( $atts  ) {

    // Attributes
    $atts = shortcode_atts(
        array(
            'name' => '',
            'height' => '500',
        ),
        $atts,
        'wiki'
    );

    // Return custom embed code
    return '<div><iframe src="https://en.wikipedia.org/wiki/' . '&name=' . $atts['name'] . '" height="' . $atts['height'] . '"/></div> ';

}
add_shortcode( 'wiki', 'wiki_show' );
问题是,在第一个iframe之后,没有显示任何内容(甚至在第一个iframe之后的BBBB…)

如果我将短码代码改为标记一些“foo”而不是“iframe”,它将正确显示所有代码

如果我手动嵌入2个iframe(没有短代码),效果很好

如何使快捷码工作?我做错了什么

(*学分:此代码改编自:)

元素。你应该把它改成

return '<div><iframe […]></iframe></div>';
返回“”;
还可以查看HTML验证程序,它会发现这个问题。;-)

元素。你应该把它改成

return '<div><iframe […]></iframe></div>';
返回“”;
还可以查看HTML验证程序,它会发现这个问题。;-)