首页 文章

Wordpress入队错误,如何解决?

提问于
浏览
0

当我尝试测试运行此代码时,我不断从php中获取wordpress中的错误,这与教程完全相同 .

Notice: Use of undefined constant add - assumed 'add' in /home/genera58/public_html/wp-content/themes/twentyfifteenG-CHILD/functions.php on line 6

Fatal error: Call to undefined function action() in /home/genera58/public_html/wp-content/themes/twentyfifteenG-CHILD/functions.php on line 6 string(11) "HALO Fatal:" string(35) "Call to undefined function action()" string(79) "/home/genera58/public_html/wp-content/themes/twentyfifteenG-CHILD/functions.php" int(6)

码:

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

是什么要求我确切地解决?一切都有正确的引用 . 抱歉,我是初学者

1 回答

  • 2

    这是你正在寻找的功能 add_action() 而不是 add-action()

    https://codex.wordpress.org/Function_Reference/add_action

    另请注意,连字符不允许作为函数名称的一部分,有可能以这种方式使用它,但这远远超出了此问题的范围 .

相关问题