This topic has 13 replies, 3 voices, and was last updated 7 years, 3 months ago ago by Rose Tyler
As per the title, we’re having issues getting the child theme css to override the default theme css, probably something simple we’ve got wrong but would appreciate some assistance.
In functions.php (in child theme) we have:
<?php add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array( ‘bootstrap’, ‘parent-style’ ) );
}
and in child style.css we have removed the @import of the default css.
Anything else we have missed? I’ve added login details below if you need them.
Thank you in advance.
As an extra query, on this support section of your website, you have a nice blue header image with the title and breadcrumbs appearing within it … could you give us a quick idea of the settings you’ve used to create this as we’d like to do something similar within the site we are creating.
Thanks!
Hi,
1. Use this Child theme: http://take.ms/6RCTI
2. You can adjust these settings http://take.ms/uF9jJ to get the similar effect.
Let us know,
Thanks,
laranz.
OK, have changed the child files but still not getting our child css to override the default css without using “!important”.
Additionally, we are trying to change the separator between the breadcrumb elements and want to use
” > ” instead of “/”.
I can see it is the main royal theme in framework/theme-functions.php
When we duplicate this file and edit the relevant line (#3181) and put it in either:
royal-child/framework/theme-functions.php
or
royal-child/theme-functions.php
It doesn’t change anything.
Could you advise where any override files need to be stored in the child theme (whether they should retain exactly the same structure as the main theme or whether they are simply placed in root of child theme) and also what format the “>” symbol needs to be when altering the .php file (use symbol as is, or use one of these:
U+0003E
UNICODE
>
HEX CODE
>
HTML CODE
>
HTML ENTITY.
Thank you.
Hi,
1. You can change that value via Theme Options -> Page Heading, in case you want some other settings other that that, you can use this CSS class.
.page-heading #breadcrumb, .page-heading .delimeter, .back-history, .page-heading a, .page-heading .woocommerce-breadcrumb, .page-heading .title { }
2. In theme-functions.php you will see this function, “etheme_breadcrumbs” you can copy paste that in to your child theme and you can edit that according to your needs. The line you need to edit is, #3181.
Or try this Custom CSS,
#breadcrumb a::after {
content: ' > ';
}
.delimeter {
display: none;
}
Let us know,
Thanks,
laranz.
Thanks for the reply … just to clarify
1. With the breadcrumbs function, are you saying to copy/paste only the code we want to change directly into the functions.php file in child theme, not copy the entire theme-functions.php file?
2. With the css, we already have the css code we want to override in the child style.css file, but it’s not overriding the original default css (in index.php when I view source). If you look at the screenshot I sent, you’ll see our new code, and there are 3 x parts that won’t override the defaults without the use of !important in our new css file.
still got problems, see private details please
Hi,
1. Don’t copy the whole file to the child theme, just copy that function alone and make the necessary edit, but did the CSS I gave works?
2. Also the CSS is indeed loading, http://take.ms/mMgAH like I said, the options from theme options load first, you can change the settings in the Theme Options page, other settings you can override in the child, if you want to override the theme options settings, you need to use !important in the style.css.
Make sure there is no error in the style.css like a missing curly braces, { or } in that case also few styles will be omitted. Double check that.
Let us know,
Thanks,
laranz.
OK, thank you, I went back to using the original code in the functions.php as that worked better rather than the new code you sent through.
Hi,
So the issues are all solved?
Let us know if you have any other questions,
Thanks,
laranz.
All good for now thank you.
You’re welcome!
Regards
The issue related to '‘Child theme css not overriding default css’' has been successfully resolved, and the topic is now closed for further responses