我试图在字符串中添加一个函数,以通过简码显示函数的输出,但它显示错误。在变量字符串中添加函数
function foo_shortcode($atts, $content = null) {
$datashortcode = '<div>'
.if(function_exists('rtb_kk'))
{
rtb_kk();
}.
'</div>'
;
return $datashortcode;
}
add_shortcode('showfoo', 'foo_shortcode');
我在哪里犯错?
你根本无法做到这一点。这是语法错误。 –
这么多的语法错误,首先阅读一些关于PHP的教程,然后写一个插件到wordpress :) – jamek