Javascript Wordpress排队错误,如何修复?

Javascript Wordpress排队错误,如何修复?,javascript,php,wordpress,Javascript,Php,Wordpress,当我试着测试运行这段代码时,我在php的wordpress中不断遇到这个错误,这与教程中的相同 注意:在第6行的/home/genera58/public_html/wp content/themes/twentyfifteenG CHILD/functions.php中使用未定义的常量add-假定为“add” 致命错误:在第6行的/home/genera58/public_html/wp content/themes/twentyfifteenG CHILD/functions.php中调用未

当我试着测试运行这段代码时,我在php的wordpress中不断遇到这个错误,这与教程中的相同

注意:在第6行的/home/genera58/public_html/wp content/themes/twentyfifteenG CHILD/functions.php中使用未定义的常量add-假定为“add”

致命错误:在第6行的/home/genera58/public_html/wp content/themes/twentyfifteenG CHILD/functions.php中调用未定义的函数action() string(11)“HALO Fatal:”string(35)”调用未定义的函数action()“string(79)”/home/genera58/public\u html/wp content/themes/twentyfifteenG CHILD/functions.php“int(6)

代码:


这是您要查找的函数
add\u action()
,而不是
add-action()

还请注意,连字符不允许作为函数名的一部分,有一些方法可以这样使用,但这远远超出了本问题的范围。

我们将尝试添加_action(),在php中连字符不允许作为函数名
<?php 

function twentyfifteen_child_scripts() {
    wp_enqueue_script( 'transition js', get_stylesheet_directory_uri() . '/js/transition.js' );
}
add-action('wp_enqueue_scripts','twentyfifteen_child_scripts');