This seems like a common problem but as I modify my child themes style.css the parent style.css rules override any changes I make.
One of the main solutions seems to be to correctly enqueuing your functions.php file. I have no experience in php but I have copy and pasted a number of versions of doing so with no luck. Here is my functions.php code in my child theme folder.
<?php
//
// Recommended way to include parent theme styles.
// ( Please see https://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme )
//
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')
);
}
//
// Your code goes below
//
My parent theme is Adios. Here is the PHP from the parent theme. It was in rs-actions-config.php
. I didn't exclude any code because I'm not sure what is and isn't relevant.
Edit: Here is the relevant code:
/**
* @return null
* @param none
* loads all the js and css script to frontend
**/
if( !function_exists('adios_enqueue_scripts')) {
function adios_enqueue_scripts() {
if( ( is_admin() ) ) { return; }
if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); }
// enqueue script
wp_enqueue_script( 'adios-scrollify', get_template_directory_uri() .'/js/jquery.scrollify.min.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_enqueue_script( 'adios-wow', get_template_directory_uri() .'/js/wow.min.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_enqueue_script( 'adios-count', get_template_directory_uri() .'/js/jquery.countTo.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_enqueue_script( 'adios-isotope', get_template_directory_uri() .'/js/isotope.pkg.min.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_enqueue_script( 'adios-img-loaded', get_template_directory_uri() .'/js/jquery.imageloaded.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_enqueue_script( 'adios-all', get_template_directory_uri() .'/js/all.js',array('jquery'), ADIOS_THEME_VERSION,true);
// register script
wp_register_script( 'adios-gmapsensor', ' http://maps.google.com/maps/api/js?sensor =false',array('jquery'), ADIOS_THEME_VERSION,true);
wp_register_script( 'adios-swiper', get_template_directory_uri() .'/js/swiper.min.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_register_script( 'adios-cd-google-map', get_template_directory_uri() .'/js/map.js',array('adios-gmapsensor'), ADIOS_THEME_VERSION,true);
wp_register_script( 'adios-youtube', get_template_directory_uri() .'/js/jquery.youtubebackground.js',array('jquery'), ADIOS_THEME_VERSION,true);
wp_localize_script('adios-cd-google-map', 'get',
array(
'ajaxurl' => esc_url(admin_url( 'admin-ajax.php' )),
'siteurl' => get_template_directory_uri()
)
);
wp_enqueue_style( 'adios-fonts', adios_fonts_url(), null, ADIOS_THEME_VERSION );
wp_enqueue_style( 'adios-bootstrap', get_template_directory_uri(). '/css/bootstrap.min.css',null, ADIOS_THEME_VERSION);
wp_enqueue_style( 'adios-main-style', get_template_directory_uri(). '/css/style.css',null, ADIOS_THEME_VERSION);
wp_enqueue_style( 'adios-fonttello', get_template_directory_uri(). '/css/fontello.css',null, ADIOS_THEME_VERSION);
wp_enqueue_style( 'adios-animate', get_template_directory_uri(). '/css/animate.css',null, ADIOS_THEME_VERSION);
// register
wp_register_style('adios-swiper', get_template_directory_uri(). '/css/idangerous.swiper.css',null, ADIOS_THEME_VERSION);
// Custom CSS
$css_code = adios_get_opt('css_editor');
$style = '';
$style .= ( !empty($css_code)) ? $css_code:'';
wp_add_inline_style('main-style', $style);
}
add_action( 'wp_enqueue_scripts', 'adios_enqueue_scripts' );
}
I am locally hosting my site so I can't share a link to it.
I'm assuming there is a problem with this code but in all honesty I'm up for any other solutions someone may have. Been stuck on this problem for awhile. Cheers.
array('parent-style')
" and call your child theme's css without this array like in the same way, you called parent theme's css in which you haven't used any array.style.css
file like this "wp_enqueue_style( 'child-style', get_stylesheet_uri() );
" instead of this "wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() .'/style.css', array('parent-style'));
"