I have a Wordpress website where the child theme is activated. It seems that everything is working fine, except the stylesheet. The CSS file isn't included.
In function.php file in the child theme:
function enqueue_child_styles() {
wp_enqueue_style('child-theme', get_stylesheet_directory_uri() .'/style.css', array('parent-theme'));
}
add_action('wp_enqueue_scripts', 'enqueue_child_styles');
The style.css file is in the root folder of the child theme:
But the styles aren't reflected on my website itself.
My child theme CSS:
/*
Theme Name: Vitrine Child
Theme URI: http://themeforest.net/user/Epicomedia
Template: vitrine
Author: EpicoMedia
Author URI: http://www.Epicomedia.com
Description: WooCommerce WordPress Theme
Tags: two-columns,three-columns,left-sidebar,right-sidebar,custom-background,custom-header,custom-menu,editor-style,featured-images,flexible-header,full-width-template,microformats,post-formats,sticky-post,theme-options,translation-ready,accessibility-ready
Version: 1.0.1498974811
Updated: 2017-07-02 05:53:31
*/
/* Write your styles here */
/* Cookiebot */
a#CybotCookiebotDialogBodyLevelButtonAccept {
background: #E5002F !important;
border: none !important;
}
/* WPCF7 form submit button */
.wpcf7-form-control.wpcf7-submit {
border-color: black;
color: black;
}
function.php in child theme:
<?php
require_once dirname( __FILE__ ) . '/widgets/bln-widget-functions.php';
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
function example_enqueue_styles() {
// enqueue child styles
wp_enqueue_style('child-theme', get_stylesheet_directory_uri() .'/style.css', array('parent-theme'));
}
add_action('wp_enqueue_scripts', 'example_enqueue_styles');
array('parent-theme')
. You have to know the name of the style sheet(s) of your parent theme(s). search forwp_enqueue_style
in yourwp-content/themes
folder – yunzen