【发布时间】:2014-06-01 16:24:48
【问题描述】:
我认为这真的很简单,但花了几天时间就卡住了。
这个想法是通过简码在页面上插入表单;该表单根据用户输入计算总数。脚本和表单放在单个 HTML 文件中时可以很好地协同工作。在插件中(如您所见),JS 和 FORM 文件是分开调用的。目前,脚本在输出中加载,表单在具有简码的页面上加载,但 CALC 功能在本地或我的服务器上都不起作用。以下是我插件中的基本功能:
/* Register and enqueue the script*/
wp_register_script( 'ndm-mini-storage-calculator', plugins_url('/ndm-mini-storage-calc/ndm-mini-storage-calculator.js', __FILE__ ) );
wp_enqueue_script( 'ndm-mini-storage-calculator' );
/* Add function to load the form and add shortcode */
function show_calc_form(){
return $options = wp_remote_retrieve_body( wp_remote_get( plugins_url() . '/ndm-mini-storage-calc/mini-storage-calculator_noscript.html' ) );
}
add_shortcode('ndm-mini-calc', 'show_calc_form');
脚本和表格在这里:http://jsfiddle.net/p8j3T/2/
直播页面在这里:http://www.northwindcomputing.com/ndm-mini-storage-calc-test/
谢谢!!
【问题讨论】:
标签: javascript php forms wordpress