Importing Styles
Hi,
I've made some changes to my styles.css in my child-theme but its not showing in the actual site. In the tutorial for making child-themes I used the @import to import the original style.css from the parent. However in wordpress site, the best case practice for doing this has changed. They recommend using the following thing:
The final step is to enqueue the parent and child theme stylesheets. Note that the previous method was to import the parent theme stylesheet using @import: this is no longer best practice. The correct method of enqueuing the parent theme stylesheet is to add a wp_enqueue_scripts action and use wp_enqueue_style() in your child theme's functions.php. You will therefore need to create a functions.php in your child theme directory. The first line of your child theme's functions.php will be an opening PHP tag (<?php), after which you can enqueue your parent and child theme stylesheets. The following example function will only work if your Parent Theme uses only one main style.css to hold all of the css. If your theme has more than one .css file (eg. ie.css, style.css, main.css) then you will have to make sure to maintain all of the Parent Theme dependencies.
Code:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
Setting 'parent-style' as a dependency will ensure that the child theme stylesheet loads after it
Code:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
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')
);
}
Here is the actual link:
https://codex.wordpress.org/Child_Themes
Can someone kindly convert the above code to suit vantage theme, so I can copy it to my childs function.php file and get along with my css changes.
Thank you very much!