2012-03-06 7 views
1

私はwordpressプラグインを持っています。私はそれにcolorboxを使用したいと思います。このためには、javascriptをインポートして、プラグインでCSSをインポートする必要があります。WordPressのプラグインでCSSとjavascriptをインポート

ここに私のプラグインのコードです。

<?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'); 

?> 

上記のプラグインで次のファイルをインポートします。コーデックスcssファイルのための

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

をwp_enqueue_script wp_register_scriptや機能上の

答えて

関連する問題