I have a wordpress plugin, I want to use colorbox in it, For this i need to import javascript, and css in the plugin.
Here is my plugin code.
<?php
/*
Plugin Name: My Plugin
Plugin URI: http://www.abc.com/
Description: abc
Author: abc
Version: 1.0
Author URI: http://www.abc.com
*/
function calc_form_markup() {
$markup = <<<EOT
<form>
<input type="text" name="author" id="author" value="{$author_default}" size="22" />
<label for="author"><small>Your name*</small></label><br>
<input type="text" name="email" id="email" value="{$email_default}" size="22" /> <label
for="email"><small>Your contact e-mail*</small></label><br>
<input type="text" name="subject" id="subject" value="" size="22" /> <label
for="subject"><small>Subject*</small></label><br>
<input name="btn" type="button" id="btn" value="Send" onclick="calc();" /><br>
</form>
EOT;
return $markup;
}
add_shortcode('calc_form', 'calc_form_markup');
function calc_form_js() { ?>
<script type="text/javascript">
function calc()
{
alert ("My javascript function executes successfully...");
}
</script>
<?php }
add_action('wp_head', 'calc_form_js');
?>
And i want to import following files in the above plugin.
<link rel="stylesheet" href="colorbox.css" />
<script src="jquery.min.js"></script>
<script src="colorbox.js"></script>
Thanks in advance
Check on the codex the functions wp_register_script and wp_enqueue_script
http://codex.wordpress.org/Function_Reference/wp_enqueue_script
for the css files , it is the same system
http://codex.wordpress.org/Function_Reference/wp_enqueue_style