我在网站上使用Divi儿童主题 . 我添加了Bootstrap来创建联系表单 . 但是,只要我使用wp_enqueue_style和wp_enqueue_script将样式和脚本排入队列,顶部导航就会在悬停时获得一些额外的填充和背景颜色 .

您可以通过加载live sitedev site并比较它们来查看差异 .

这是我在子主题中的functions.php文件中的排队代码 . 当我运行它并查看源代码时,它似乎确实将主要的style.css放在bootstrap css之后,这是我所理解的,以确保style.css在这里具有特异性 . 我错过了什么?

// Enqueue Bootstrap for modal popup contact form
function wpbootstrap_scripts_with_jquery()
{
    wp_enqueue_script( 'bootstrap-js', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js' );
    wp_enqueue_style( 'bootstrap-css', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );
}

add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );

// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:

if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
    function chld_thm_cfg_parent_css() {
        wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array(  ) );
    }
endif;
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );

if ( !function_exists( 'child_theme_configurator_css' ) ):
    function child_theme_configurator_css() {
        wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'ctc-style.css', array( 'chld_thm_cfg_parent','divi-style','et-shortcodes-css','et-shortcodes-responsive-css','magnific-popup' ) );
    }
endif;
add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css' );

// END ENQUEUE PARENT ACTION