Javascript 在Wordpress中将外部JS和CSS排队

Javascript 在Wordpress中将外部JS和CSS排队,javascript,jquery,css,wordpress,enqueue,Javascript,Jquery,Css,Wordpress,Enqueue,我对我的新网站有相当大的困难 真的有两个问题 首先是调用外部JS和CSS脚本。我已经将它们添加到我的functions.php文件中,方式与我的所有其他站点相同,而且它们似乎没有加载 另一个是我的孩子主题CSS。它似乎加载在主页上,但在我的自定义页面上只制作了一个,迄今为止它没有加载。我在检查元素时检查了sources选项卡,但它没有显示 functons.php中的外部脚本和CSS代码: function external_load_scripts() { wp_register_sc

我对我的新网站有相当大的困难

真的有两个问题

首先是调用外部JS和CSS脚本。我已经将它们添加到我的functions.php文件中,方式与我的所有其他站点相同,而且它们似乎没有加载

另一个是我的孩子主题CSS。它似乎加载在主页上,但在我的自定义页面上只制作了一个,迄今为止它没有加载。我在检查元素时检查了sources选项卡,但它没有显示

functons.php中的外部脚本和CSS代码:

function external_load_scripts() {
    wp_register_script( 'popper', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' array('jquery'),'1.14.7', true );
    wp_enqueue_script( 'popper' );
    wp_register_script( 'bootstrap', 'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' array('jquery'),'4.3.1', true );
    wp_enqueue_script( 'bootstrap' );
    wp_register_script( 'datatables', 'https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js' array('jquery'),'1.10.12', true );
    wp_enqueue_script( 'datatables' );
    wp_register_script( 'chosen', 'https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.jquery.min.js' array('jquery'),'1.4.2', true );
    wp_enqueue_script( 'chosen' );
    wp_register_script( 'select', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js' array('jquery'),'4.0.0', true );
    wp_enqueue_script( 'select' );
}

add_action('wp_enqueue_scripts', 'external_load_scripts');

function external_load_styles() {
    wp_register_style( 'chosencss', 'https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.min.css' );
    wp_enqueue_style( 'chosencss' );
    wp_register_style( 'selectcss', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css' );
    wp_enqueue_style( 'selectcss' );
    wp_register_style( 'bootstrapcss', 'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' );
    wp_enqueue_style( 'bootstrapcss' );
    wp_register_style( 'allcss', 'https://use.fontawesome.com/releases/v5.0.13/css/all.css' );
    wp_enqueue_style( 'allcss' );
    wp_register_style( 'datatablescss', 'https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css' );
    wp_enqueue_style( 'datatablescss' );
}

add_action('wp_enqueue_scripts', 'external_load_styles');
在functions.php中注册子主题style.css

add_action( 'wp_enqueue_scripts', 'Eazy_Enqueue_styles' );
function Eazy_Enqueue_styles() {

    $parent_style = 'minimal-blocks-style'; 

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
} 
如前所述,child style.css似乎在主页上工作,但不是我用自定义模板设计的自定义页面


解决这个问题的任何帮助都将是巨大的。提前感谢

还有一个解决方案,我认为这不是一个好办法

您可以尝试在主题文件夹的自定义页面中粘贴完整链接css和js

例如:www.site.com/demo


文件:demo page.php

您好,谢谢您的回复。但我不确定我是否理解。你认为我能改进一下吗?my functions.php文件保存在我的子主题文件夹中