致命错误:调用未定义的函数get_template_directory_url()

时间:2017-08-02 16:15:04

标签: wordpress

我尝试将我的网站转换为WordPress并且WordPress在functions.php中给我错误

错误:

  

致命错误:在第3行的C:\ wamp \ www \ wordpress \ wp-content \ themes \ ilai-portfolio \ functions.php中调用未定义的函数get_template_directory_url()

的functions.php:

<?php
function ibsp_theme_style() {
    wp_enqueue_style( 'bootstrap_css', get_template_directory_url() . '/bootstrap/css/bootstrap.min.css', array('ilai-portfolio-style'), '20132553' );
    wp_enqueue_style( 'style_css', get_template_directory_url() . '/style.css',  array('ilai-portfolio-style'), '20132553' );
    wp_enqueue_style( 'fontawesome_css', get_template_directory_url(). '/fonts/font-awesome.min.css', array('ilai-portfolio-style'), '20132553' );
    wp_enqueue_style( 'prettyfooter_css' , get_template_directory_url() . '/css/Pretty-Footer.css', array('ilai-portfolio-style'), '20132553' );
}

add_action('wp_enqueue_scripts', 'ibsp_theme_style');

function ibsp_theme_js() {
    wp_enqueue_scripts( 'bootstrap_js', get_template_directory_url() . 'bootstrap/js/bootstrap.min.js', array('jquery'), '', true );
    wp_enqueue_scripts( 'smoothscroll_js', get_template_directory_url() . 'js/smoothscroll.js', array('jquery'), '', true );
}

add_action('wp_enqueue_scripts', 'ibsp_theme_js');
?>

1 个答案:

答案 0 :(得分:0)

您的功能中存在拼写错误

正确的功能是: get_template_directory_uri()

将“_url()”更改为“_uri()”