这是我的代码:
<?php
/*
Plugin Name: Awesome Form Validation
Plugin URI: http://itexpertbd.com
Description: Use \'required\' class to enable an input as required.
Version: 1.0
Author: Abdus Sattar Bhuiyan
Author URI: www.facebook.com/abdus.s.bhuiyan
*/
function awesome_form_validation_scripts() {
// wp_enqueue_style( \'awesome_form_validation\', get_stylesheet_uri() );
wp_enqueue_script( \'awesome_form_validation\', plugin_dir_url( __FILE__ ). \'/js/form_validation.js\', array(), \'1.0.0\', true );
}
add_action( \'wp_enqueue_scripts\', \'awesome_form_validation_scripts\' );
这很简单。但激活插件后,我看不到awesome\\u form\\u验证检查视图页面源代码。我的代码有什么问题?
最合适的回答,由SO网友:obiPlabon 整理而成
plugin_dir_url( __FILE__ )
返回带有尾部斜杠的插件URL(/
). 因此,您必须删除额外的尾部斜杠。
wp_enqueue_script( \'awesome_form_validation\', plugin_dir_url( __FILE__ ). \'js/form_validation.js\', array(), \'1.0.0\', true );