因此,我遇到了一个问题,我得到了一个“未定义的函数”的响应,我似乎不知道为什么和如何定位它。
与短代码文件的相对路径: htdocs/wp-content/mu-plugins/s/shortcodes/profile.php

配置文件卡的相对路径: htdocs/wp-content/mu-plugins/s/templates/people-card.php
我想要达到的目标:
最后,短代码将显示'profile-card.php‘页面。
中的代码
function clearline_func() {
test();
}
add_shortcode('test', 'clearline_func');我收到了一个Fatal error: Uncaught Error: Call to undefined function test()错误。
发布于 2020-01-23 09:36:21
您应该在clearline_func函数中定义所需的代码,如下所示:
function clearline_func() {
//copy & paste the profile-card.php code here
}
add_shortcode('test', 'clearline_func');如果您需要保留profile-card.php文件,并且希望避免重复代码,那么您应该使用PHP include()来像上面建议的那样调用这个文件。
https://wordpress.stackexchange.com/questions/356976
复制相似问题