import css and javascript in wordpress plugins

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.

Read More
<?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

Related posts

Leave a Reply

1 comment