-
Notifications
You must be signed in to change notification settings - Fork 4
/
functions.php
113 lines (88 loc) · 3.39 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/* -----------------------------------------------------------------------------------------------
THEME SUPPORTS
--------------------------------------------------------------------------------------------------- */
function oaknut_setup() {
add_editor_style( 'style.css' );
}
add_action( 'after_setup_theme', 'oaknut_setup' );
/* -----------------------------------------------------------------------------------------------
ENQUEUE STYLESHEETS
--------------------------------------------------------------------------------------------------- */
function oaknut_styles() {
wp_enqueue_style( 'oaknut-styles', get_template_directory_uri() . '/style.css', array(), wp_get_theme( 'oaknut' )->get( 'Version' ) );
}
add_action( 'wp_enqueue_scripts', 'oaknut_styles' );
/* -----------------------------------------------------------------------------------------------
BLOCK PATTERN CATEGORIES
Register theme specific block pattern categories. The patterns themselves are stored in /patterns/.
--------------------------------------------------------------------------------------------------- */
function oaknut_register_block_patterns() {
register_block_pattern_category( 'oaknut', array(
'label' => esc_html__( 'Oaknut Patterns', 'oaknut' ),
) );
}
add_action( 'init', 'oaknut_register_block_patterns' );
/* -----------------------------------------------------------------------------------------------
BLOCK STYLES
Register theme specific block styles.
--------------------------------------------------------------------------------------------------- */
function oaknut_register_block_styles() {
/* SHARED BLOCK STYLES */
// These shape block styles are used by multiple blocks.
$button_social_blocks = array(
'core/button',
'core/social-links'
);
$button_social_block_styles = array(
array(
'name' => 'oaknut-drop-shadow',
'label' => esc_html__( 'Drop Shadow', 'oaknut' ),
),
array(
'name' => 'oaknut-shape-angle',
'label' => esc_html__( 'Angle Shape', 'oaknut' ),
),
array(
'name' => 'oaknut-shape-bevel',
'label' => esc_html__( 'Bevel Shape', 'oaknut' ),
),
array(
'name' => 'oaknut-shape-rabbet',
'label' => esc_html__( 'Rabbet Shape', 'oaknut' ),
),
);
foreach ( $button_social_blocks as $block_name ) {
foreach ( $button_social_block_styles as $block_style_settings ) {
register_block_style( $block_name, $block_style_settings );
}
}
/* BLOCK: BUTTON */
register_block_style( 'core/button', array(
'name' => 'oaknut-shape-chevron-left',
'label' => esc_html__( 'Chevron Left Shape', 'oaknut' ),
) );
register_block_style( 'core/button', array(
'name' => 'oaknut-shape-chevron-right',
'label' => esc_html__( 'Chevron Right Shape', 'oaknut' ),
) );
register_block_style( 'core/button', array(
'name' => 'oaknut-shape-pointed',
'label' => esc_html__( 'Pointed Shape', 'oaknut' ),
) );
register_block_style( 'core/button', array(
'name' => 'oaknut-shape-ribbon',
'label' => esc_html__( 'Ribbon Shape', 'oaknut' ),
) );
/* BLOCK: COVER */
register_block_style( 'core/cover', array(
'name' => 'oaknut-space-between',
'label' => esc_html__( 'Space Between', 'oaknut' ),
) );
/* BLOCK: SOCIAL LINKS */
register_block_style( 'core/social-links', array(
'name' => 'oaknut-shape-rounded',
'label' => esc_html__( 'Rounded Shape', 'oaknut' ),
) );
}
add_action( 'init', 'oaknut_register_block_styles' );