-
Notifications
You must be signed in to change notification settings - Fork 26
/
functions.php
39 lines (34 loc) · 1.04 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Child theme functions
*
* Functions file for child theme, enqueues parent and child stylesheets by default.
*
* @since 1.0.0
* @package aa
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'aa_enqueue_styles' ) ) {
// Add enqueue function to the desired action.
add_action( 'wp_enqueue_scripts', 'aa_enqueue_styles' );
/**
* Enqueue Styles.
*
* Enqueue parent style and child styles where parent are the dependency
* for child styles so that parent styles always get enqueued first.
*
* @since 1.0.0
*/
function aa_enqueue_styles() {
// Parent style variable.
$parent_style = 'parent-style';
// Enqueue Parent theme's stylesheet.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
// Enqueue Child theme's stylesheet.
// Setting 'parent-style' as a dependency will ensure that the child theme stylesheet loads after it.
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ) );
}
}