【发布时间】:2023-03-28 12:05:01
【问题描述】:
我正在尝试在字符串中添加一个函数以通过简码显示函数的输出,但它显示错误。
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 :)
标签: php wordpress plugins shortcode