Description
The wsf_enqueue_scripts action hook runs whenever a form is present on a page and allows you to enqueue custom JavaScript. This action will only run once per page.
To learn how to enqueue scripts in WordPress see: wp_enqueue_script
Usage
add_action( 'wsf_enqueue_scripts', 'my_hook_function', 10, 1 );
Parameters
$in_footer
BooleanIf WS Form is configured to print scripts in the footer.
Example
// Callback function for the wsf_enqueue_scripts action hook function my_hook_function( $in_footer ) { // JavaScript file URL $js_file_url = sprintf( '%s/my-custom.js', get_bloginfo( 'template_directory' ) ); // Enqueue JavaScript file wp_enqueue_script( 'my-custom-js', $js_file_url, array(), false, array( 'in_footer' => $in_footer ) ); } // Add a callback function for the wsf_enqueue_scripts action hook add_action( 'wsf_enqueue_scripts', 'my_hook_function', 10, 1 );
Source File
This hook can be found in:<plugin root>/public/class-ws-form-public.php