-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
85 lines (64 loc) · 2.23 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* This file adds functions to the Avant-Garde WordPress theme.
*
* @package Avant-Garde
* @author WP Engine
* @license GNU General Public License v2 or later
* @link https://briangardner.com/
*/
if ( ! function_exists( 'avant_garde_setup' ) ) {
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*
* @since 1.0
*
* @return void
*/
function avant_garde_setup() {
// Make theme available for translation.
load_theme_textdomain( 'avant-garde', get_template_directory() . '/languages' );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Enqueue editor styles and fonts.
add_editor_style(
array(
'./style.css',
avant_garde_fonts_url(),
)
);
// Disable loading core block inline styles.
add_filter( 'should_load_separate_core_block_assets', '__return_false' );
// Remove core block patterns.
remove_theme_support( 'core-block-patterns' );
}
}
add_action( 'after_setup_theme', 'avant_garde_setup' );
// Enqueue style sheet.
add_action( 'wp_enqueue_scripts', 'avant_garde_enqueue_style_sheet' );
function avant_garde_enqueue_style_sheet() {
wp_enqueue_style( 'avant-garde', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
}
// Enqueue fonts.
add_action( 'wp_enqueue_scripts', 'avant_garde_enqueue_fonts' );
function avant_garde_enqueue_fonts() {
wp_enqueue_style( 'avant-garde-fonts', avant_garde_fonts_url(), array(), null );
}
// Define fonts.
function avant_garde_fonts_url() {
$fonts = array(
'family=Outfit:wght@100;200;300;400;500;600;700;800;900',
);
// Make a single request for all Google Fonts.
return esc_url_raw( 'https://fonts.googleapis.com/css2?' . implode( '&', array_unique( $fonts ) ) . '&display=swap' );
}
// Include block styles.
require get_template_directory() . '/inc/block-styles.php';
// Include block patterns.
require get_template_directory() . '/inc/block-patterns.php';