如果短代码用于页面内容,我想向页面页脚添加javascript。
add_shortcode(\'show-popup\', \'show_aip_popup\');
function show_aip_popup($args){
// HTML Comes here for popup
}
如果短代码用于页面内容,我想向页面页脚添加javascript。
add_shortcode(\'show-popup\', \'show_aip_popup\');
function show_aip_popup($args){
// HTML Comes here for popup
}
请试试这个
function show_aip_popup($args){
wp_enqueue_script( \'parent-stylesheet\', \'javascript file\', false );
//your code for show shortcode data
}
谢谢你的帮助
我在google上搜索了一下,最后得到了ans,我只在shortcode函数中添加了一行代码,得到了ans。
我在shortcode函数中添加了以下行。
wp_enqueue_script( \'parent-stylesheet\', \'[js URL]\' . $postId, false );
我在做短码,我被困在这里了。以下是代码:add_shortcode(\'service-shortcode\', \'service_shortcode\'); function service_shortcode($atts) { extract( shortcode_atts( array( \'title\' => \'Service One\', \'icon\' => \'fa-briefcase\'