Wordpress 웹 사이트에 눈 가을 효과를 만드는 플러그인을 개발하려고합니다. 나는 그것이 작동 내 테마에서이 jQuery 코드를 복사 할 때WP 테마 코드를 독립 실행 형 플러그인으로 변환
<?php
/*
Plugin Name: tuhin
Plugin URI: no plugin uri
Description: This plugin will add a Simple & lightweight responsive slider.
Author: tuhin
Author URI: no author uri
Version: 1.0
*/
/* Launch the plugin. */
add_action('plugins_loaded', 'wp_snowfall_plugins_loaded');
/* Initializes the plugin and it's features. */
function wp_snowfall_plugins_loaded() {
/* Set constant path to the members plugin directory. */
define('WP_SNOWFALL_DIR', plugin_dir_path(__FILE__));
/* Set constant path to the members plugin directory. */
define('WP_SNOWFALL_URL', plugin_dir_url(__FILE__));
/* Loads the snowfall. */
add_action('wp_head', 'wp_snowfall_source');
add_action('wp_head', 'wp_snowfall_effect');
}
function wp_snowfall_source() {
wp_enqueue_script('jquery.js');
wp_enqueue_script('snowfall', WP_SNOWFALL_URL.'snow.min.jquery.js');
}
function wp_snowfall_effect() { ?>
<script type="text/javascript">
$(document).ready(function(){
$.fn.snow();
});
</script>
<?php
}
?>
,하지만 난 플러그인으로 변환 할 때 작동하지 않습니다 : 내 코드는 다음과 같습니다. 그게 뭐가 잘못 됐어?
당신이 설치 한 워드 프레스의 관리자 패널을 통해 활성화 할 플러그인을 만들 때? – chrislondon
그래, 나는 플러그인을 활성화했다. –
당신은 다음을 사용 해본 적이 있습니까 :'wp_enqueue_script ('snowfall', WP_SNOWFALL_URL.'snow.min.jquery.js ', array ('jquery ')); 어떤 콘솔/PHP 로그 오류가 있습니까? – Joe