【发布时间】:2018-04-09 09:32:16
【问题描述】:
我想在 WordPress 中从我的 functions.php 调用一个 jQuery。
我正在使用 Divi 主题。当我将脚本直接添加到 Divi 主题中时,它可以工作。但我想将它添加到我的子主题的functions.php 中,这就是问题的开始。
函数.php
function coolbanner_enqueue() {
wp_enqueue_script( 'custom-scripts', get_stylesheet_directory_uri() . '/js/coolbanner.js', array( 'jquery' ));
}
add_action( 'wp_enqueue_scripts', 'coolbanner_enqueue' );
脚本:
jQuery(document).ready(function(){
jQuery('#cta-section').waypoint(function() {
jQuery('#cta-section').toggleClass('animate-cta');
}, {offset: '80%'});
});
谁能指出我做错了什么?
【问题讨论】:
-
有什么问题?
-
它不起作用,我不知道为什么
-
控制台出现什么错误?
-
没有错误。检查 test.bloomford.be
-
我在你的主题中看不到
waypointjs
标签: php jquery wordpress wordpress-theming