Jan 04

When developing a smooth plugin for WordPress you will quite often need to supplement php and html with some kind of scripting language. To make the floating input form for the DiveBook plugin I used jQuery and I used Javascript to validate user input and redirecting.

To include your script files to the plugin you need to add the following code in your main php file:

//Add script
add_action('wp_print_scripts', 'divebook_enqueue_js');

function divebook_enqueue_js () {
    wp_enqueue_script('divebookFunctions', WP_CONTENT_URL . '/plugins/divebook/functions.js', array('jquery'),'1.0.1');
    wp_enqueue_script('divebookPopup', WP_CONTENT_URL . '/plugins/divebook/divepopup.js', array('jquery'),'1.0.1');

Continue reading »

Tagged with:
Subscribe to my feeds Follow me on Twitter