Can someone show me how to include this javascript file into my wordpress plugin?. I have tried all the wp_enqeue_script() methods but nothing happens.
ok here is my example plugin code with comments explaining what I would like.
<?php
/*
Plugin Name: Edureka Test
Plugin URI: http://#.com
Description: A plugin that is used for my javascript tests
Author: niroj Dey
Author URI: http://edureka.co
version: 1.001
*/
include(popup.js);
/*when I include it this way, it works fine, but gives an error when I activate the plugin
'plugin generated 453 characters ...'
*/
function popup() {
$src = plugins_url('popup.js', __FILE__);
wp_register_script( 'popup', $src );
wp_enqueue_script( 'popup' );
}
/*
when I included it this way, plugin is activated but nothing happens.
*/
?>
So does anybody know how to call this script to work correctly in wordpress plugin?