我正在构建我的第一个短代码,但现在做的不多,下面是我的代码:
class Shortcodes {
public static function notifications_shortcode($atts, $content = "") {
return \'notifications foo foo\';
}
}
我在另一节课上这样叫这个:class Loader extends MvcPluginLoader {
function activate () {
add_shortcode(\'ls_notifications\', array(\'Shortcodes\', \'notifications_shortcode\'));
}
}
但出于某种原因,我不能在任何帖子中使用它[ls_notifications][/ls_notifications]
没有显示错误,我唯一能想到的是没有添加短代码ins,但我不知道为什么。我知道这可能与这个问题有关Add_shortcode as a Class to pass arguments to a function 还有这个页面Shortcode API 但我似乎错过了什么。