- This topic has 2 replies, 2 voices, and was last updated 6 years, 11 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forums › Pro Themes › Onefold Pro › Overiding CSS in a child theme
Tagged: child themes, css, customization
Hello!
I notice that when trying to change such things as…
/* slider headers and captions */
#main-slider p, #main-slider h3 {
background-color: rgba(0,0,0,.37);
}
I can only seem to override styles in the “Additional CSS” section within the theme vs. WordPress’ editor which is writing to a child-theme .css file that I have enqued within funtions.php.
Is there any reason why the “Additional CSS” area within the theme’s customization area is taking precedence over my custom CSS file which is set up in a child theme?
This functionality would be helpful on several fronts when using my child theme.
Any advice would be greatly appreciated.
From my functions.php…
<?php
function my_theme_enqueue_styles() {
$parent_style = ‘onefold-pro’; // This is ‘onefold-pro’ parent.
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’)
);
}
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
?>
Overriding CSS seems to work in my enqued .css now.
This is only when I select “default” in the associated color palette?
#main-slider p, #main-slider h3 {
background-color: rgba(0,0,0,.33);
}
now works in another area.
Is this normal behavior?
For anything that I want to overwrite, do I keep the theme defaults in place?
Is there a conditional that delivers this behavior?
Really sorry for all of the questions.
Your advice and help is always appreciated.
Sincerely,
Dick
Hello @dickkirkland,
The CSS that is included in the Additional CSS of the customizer will load at first and this how theme works.
So if you have to overwrite any CSS within the theme then you can post the CSS in Additional CSS as it load at first.
You can also use child theme for any style modification in the theme if you have to make lots of modification but if you have to modify just one, 2 section then you can use additional CSS.
Hope this helps.
Best Regards!!
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |