脚本加载问题


Scripts loading problems?

所以我正在将一个html模板转换为wordpress主题,我在index.php、footer.php、header.php和style.css中添加了所有特定的标记,看起来我的脚本无法正确加载。这是我要转换的网站:http://iulian.cablevision.ro/rock4life/我在本地主机上安装了wordpress,以便在沙箱中播放。我认为问题出在functions.php内部?我的网站就是这样加载的:http://iulian.cablevision.ro/rock4life_wp/。我一开始也删除了加载屏幕,因为根本不会加载网站。。。检查whit firebug将不会显示任何脚本。function.php文件:

<?php
function firstwp_resources(){
    wp_enqueue_style('style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts','firstwp_resources');
   function your_scripts() {
                    wp_register_script('jquery', 'js/jquery.js', true);
                    // This registers your script with a name so you can call it to enqueue it
                    wp_enqueue_script( 'jquery' );
                    // enqueuing your script ensures it will be inserted in the propoer place in the header section
                    wp_register_script('jquery.reveal', 'js/jquery.reveal.js', true);
                    wp_enqueue_script( 'jquery.reveal' );
                    wp_register_script('jquery.backstretch', 'js/jquery.backstretch.min.js', true);
                    wp_enqueue_script('jquery.backstretch');
                    wp_register_script('jquery.tweet', 'js/jquery.tweet.js', true);
                    wp_enqueue_script('jquery.tweet');
                    wp_register_script('mediaelement-and-player', 'js/mediaelement-and-player.min.js', true);
                    wp_enqueue_script('mediaelement-and-player');
                    wp_register_script('custom', 'js/custom.js', true);
                    wp_enqueue_script('custom');
                    wp_register_script('jquery.placeholder', 'js/jquery.placeholder.min.js', true);
                    wp_enqueue_script('jquery.placeholder');
            }
            add_action('wp_enqueue_scripts', 'your_scripts');
            // This hook executes the enqueuing of your script at the proper moment.

这将确保要加载的脚本,并确保Dashboard的脚本是安全的。

<?php
function firstwp_resources() {
    if (!is_admin()) {
        // Default Scripts
        wp_deregister_script('jquery');
        wp_register_script('jquery', get_template_directory_uri().'/assets/js/jquery.js', false, null);
        wp_enqueue_script('jquery');
        wp_deregister_script('jquery-mig');
        wp_register_script('jquery-mig', get_template_directory_uri().'/assets/js/jquery-mig.js', false, null);
        wp_enqueue_script('jquery-mig');
        // Other Scripts
        wp_enqueue_script('name', get_template_directory_uri().'/assets/js/name.js', false, null, true); // loads in footer
    }
}
add_action('wp_enqueue_scripts', 'firstwp_resources');
?>

WordPress 包含和注册的默认脚本