如何调用第三方插件的过滤器并将其分配给短代码

发布于 2025-01-29 02:42:14 字数 565 浏览 1 评论 0原文

我对整个WordPress世界的新手很陌生,因此我可以需要一些帮助。我有一个第三方插件,可提供许多操作,过滤器和功能。如何在我的function.php文件中调用它们并为其分配一个短代码,以便在这种情况下我可以在单个页面模板上使用它?

这是一个示例:

“在此处输入图像描述”

这就是我到目前为止尝试的,但它在前端没有任何操作:

function wpc_elementor_shortcode( $atts ) {
    echo apply_filters( 'sensei_lesson_count', $post_args );
}
add_shortcode( 'my_elementor_php_output', 'wpc_elementor_shortcode'); 

I'm pretty new to the whole WordPress world so I could need some help. I have a 3rd party plugin that provides a bunch of actions, filters, and functions. How can I call them in my functions.php file and assign a shortcode to it, so I can use it on a single page template in this case?

Here is an example:

enter image description here

That's what I tried so far, but it doesn't do anything on the front-end:

function wpc_elementor_shortcode( $atts ) {
    echo apply_filters( 'sensei_lesson_count', $post_args );
}
add_shortcode( 'my_elementor_php_output', 'wpc_elementor_shortcode'); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文