【发布时间】:2021-06-20 14:17:55
【问题描述】:
我在创建 WordPress 短代码时遇到了一些问题,因此我可以将其放在我的 Elementor 页面模板下。
// Shortcode to output custom PHP in Elementor
function luxis_ics_endpoint( $atts ) {
return '<a href="'.<?php echo get_feed_link("calendar"); ?>?id=<?php echo get_the_ID(); ?>"> Download .ics </a>';
}
add_shortcode( 'my_elementor_php_output', 'luxis_ics_endpoint');
所以返回,我不知道如何正确编写它,以便它可以获取那些 PHP 代码并在短代码中生成一个链接供我在前端使用。
任何建议将不胜感激!
【问题讨论】:
-
如果你想将它作为“小部件”添加到 elementor,你需要编写一些额外的代码来告诉 elementor shordcode 及其设置。 elementor developers documentation 中提供了一些相关信息,可帮助您入门。
标签: php wordpress shortcode elementor