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
Wordpress php函数在一个";do“u shortcode”;如果存在打开和关闭短代码_Wordpress_Shortcode - Fatal编程技术网

Wordpress php函数在一个";do“u shortcode”;如果存在打开和关闭短代码

Wordpress php函数在一个";do“u shortcode”;如果存在打开和关闭短代码,wordpress,shortcode,Wordpress,Shortcode,我有这样一个函数: function example(){ foreach($array ad $ar){ echo $ar[0]; } } 我想在一个短代码打开和关闭类型中插入: echo do_shortcode('[iscorrect]'.example().'[/iscorrect]'); 我怎么做 谢谢并原谅我的英语。如果你不顾一切,你可以做 function example(){ $output = ""; foreach($array as $ar){

我有这样一个函数:

function example(){

foreach($array ad $ar){
echo $ar[0];
}

}
我想在一个短代码打开和关闭类型中插入:

echo do_shortcode('[iscorrect]'.example().'[/iscorrect]');
我怎么做


谢谢并原谅我的英语。

如果你不顾一切,你可以做

function example(){
    $output = "";

    foreach($array as $ar){
        $output .= $ar[0];
    }

    return $output;
}
虽然我不认为这是最好的方法,因为您可以在处理
[iscorrect]
短代码本身的函数中调用函数
example()
的内容