Skip to main content
Tweeted twitter.com/StackWordPress/status/1084601145786552322
Add code formatting, remove two tags, fix grammar, misc highlighting
Source Link

I recently changed my word pressWordPress site to use child themes, howeverbut the parent theme style has priority over any change I make on the child theme CSS. I can work around it using "!important"!important, however this is a patchy solution and the child themes should work as the sitesite's first resource.

For example, in my site http://blindalleycomic.com/my site The, the border that includes the caption .wp-caption.wp-caption is the same color as the background using the !important!important tag, but won't work without it.

Does this have to do with the functions.php file?

This is my currentthe contents of my phpPHP file:

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );}

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

I recently changed my word press site to use child themes, however the parent theme style has priority over any change I make on child theme CSS. I can work around it using "!important" however this is a patchy solution and the child themes should work as the site first resource.

For example in my site http://blindalleycomic.com/ The border that includes the caption .wp-caption is the same color as the background using the !important tag but won't work without it.

Does this have to do with the functions.php file?

This is my current contents of my php file

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );}

I changed my WordPress site to use child themes, but the parent theme style has priority over any change I make on the child theme CSS. I can work around it using !important, however this is a patchy solution and the child themes should work as the site's first resource.

For example, in my site, the border that includes .wp-caption is the same color as the background using the !important tag, but won't work without it.

Does this have to do with the functions.php file?

This is the contents of my PHP file:

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
Source Link
Dharkov
  • 113
  • 1
  • 1
  • 6

Child themes CSS priority problems without using !important

I recently changed my word press site to use child themes, however the parent theme style has priority over any change I make on child theme CSS. I can work around it using "!important" however this is a patchy solution and the child themes should work as the site first resource.

For example in my site http://blindalleycomic.com/ The border that includes the caption .wp-caption is the same color as the background using the !important tag but won't work without it.

Does this have to do with the functions.php file?

This is my current contents of my php file

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );}