I\'ve created a custom child theme of parent theme Cordillera.
This is my child theme\'s header.php (<head>
):
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="<?php bloginfo( \'charset\' ); ?>" />
<?php wp_head();?>
<?php
global $enable_home_page;
$banner = "";
$home_banner_type = cordillera_options_array("home_banner_type",1);
$enable_home_page = cordillera_options_array("enable_home_page");
if( is_front_page() ){
$class = "homepage";
$banner = cordillera_get_banner($home_banner_type);
}
else
{
$class = "sitepage";
}
?>
<link href=\'http://fonts.googleapis.com/css?family=Waiting+for+the+Sunrise\' rel=\'stylesheet\' type=\'text/css\'>
<link href=\'http://fonts.googleapis.com/css?family=Open+Sans\' rel=\'stylesheet\' type=\'text/css\'>
<?php if(!(is_front_page())) { ?>
<!-- non-front-page CSS -->
<style>
html {
background-color: transparent;
background: url(\'<?php echo get_stylesheet_directory_uri(); ?>/images/bg-product.jpg\') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
<!-- END non-front-page CSS -->
</style>
<?php } ?>
<?php if(is_page(6)) { ?>
<!-- shop page CSS -->
<style>
.blog-main {
background-color: transparent !important;
}
</style>
<!-- shop page CSS -->
<?php } ?>
</head>
I haven\'t included a link to my child theme\'s style.css
in this file, instead using:
add_action( \'wp_enqueue_scripts\', function() {
wp_register_style( \'childstyle\', get_stylesheet_uri());
wp_enqueue_style( \'childstyle\', get_stylesheet_uri());
});
in my child theme\'s functions.php
.
However, when logged into Wordpress admin, and viewing WooCommerce pages, some of the admin tool bar links are being colored by my child theme\'s style.css
.
How can I prevent this? Thanks.
最合适的回答,由SO网友:denis.stoyanov 整理而成
重新构造CSS文件并删除!important
您的.css
并使用适当的标记(类、ID等)。
e、 g。
a, .entry-summary a, .entry-content a {
color: #06F !important;
font-weight: 400;
}
从测试WS判断,该测试是通过site:在Google中使用Facebook个人资料中的URL进行搜索(脾气脾气)。
Edit 1: 虽然!important
规则有时很方便,通常会破坏结构,尤其是在没有进行适当和详细规划的情况下。