1

我有一个用户将根据体能测试结果填写的表格,即每分钟俯卧撑、每分钟仰卧起坐、2 英里跑步时间等。该表格正在提交到一个自定义模板页面,该页面也可以正常工作。然而,我想使用这个jquery 插件来帮助我验证我的表单。

如何将这样的 jQuery 库添加到 wordpress 中,以便我可以验证我的表单

4

1 回答 1

0

打开您的functions.php并添加以下代码:

//ad our custom Jquery
 function init_js_scripts() {
if (!is_admin()) {
    wp_register_script('jquery', ('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'), false, '');
    wp_enqueue_script('jquery');

    // load a JS file from your  theme: js/theme.js
    //You will need to create js Folder and put your script in there...
    wp_enqueue_script('my_cool_script', get_template_directory_uri() . '/js/cool_script.js', array('jquery'), '1.0', true);
}
    }
    add_action('init', 'init_js_scripts');
于 2013-05-16T18:28:32.583 回答