-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
153 lines (134 loc) · 3.76 KB
/
functions.php
File metadata and controls
153 lines (134 loc) · 3.76 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/**
* Simplenet functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Simplenet
* @since Simplenet 1.0
*/
if ( ! function_exists( 'simplenet_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since Simplenet 1.0
*
* @return void
*/
function simplenet_setup() {
// Remove theme support for the core and featured patterns coming from the WordPress.org pattern directory (for now).
remove_theme_support( 'core-block-patterns' );
}
endif;
add_action( 'after_setup_theme', 'simplenet_setup' );
if ( ! function_exists( 'simplenet_styles' ) ) :
/**
* Enqueue main stylesheet.
*
* @since Simplenet 1.0
*
* @return void
*/
function simplenet_styles() {
$theme_version = wp_get_theme()->get( 'Version' );
$version_string = is_string( $theme_version ) ? $theme_version : false;
// Register theme stylesheet.
wp_register_style(
'simplenet-style',
get_template_directory_uri() . '/style.css',
array(),
$version_string
);
// Enqueue theme stylesheet.
wp_enqueue_style( 'simplenet-style' );
}
endif;
add_action( 'wp_enqueue_scripts', 'simplenet_styles' );
if ( ! function_exists( 'simplenet_editor_styles' ) ) :
/**
* Enqueue style.css into the editor.
*
* @since Simplenet 1.0
*
* @return void
*/
function simplenet_editor_styles() {
// Enqueue theme stylesheet there are custom styles.
add_editor_style( 'style.css' );
}
endif;
add_action( 'admin_init', 'simplenet_editor_styles' );
// Registers custom block styles.
if (!function_exists("simplenet_block_styles")):
/**
* Registers custom block styles.
*
* @since Simplenet 1.0
*
* @return void
*/
function simplenet_block_styles()
{
register_block_style("core/list", [
"name" => "simplenet-checkmark",
"label" => __("Checkmark", "simplenet")
]);
register_block_style("core/list", [
"name" => "simplenet-dash",
"label" => __("Dash", "simplenet")
]);
register_block_style("core/list", [
"name" => "simplenet-arrow",
"label" => __("Arrow", "simplenet")
]);
register_block_style(
'core/details',
[
'name' => 'simplenet-plus-minus',
'label' => __( 'Plus / Minus', 'simplenet' ),
]
);
register_block_style(
'core/search',
[
'name' => 'simplenet-underline',
'label' => __( 'Underline', 'simplenet' ),
]
);
register_block_style("core/columns", [
"name" => "simplenet-mobile-reverse",
"label" => __("Reverse on Mobile", "simplenet"),
]);
}
endif;
add_action("init", "simplenet_block_styles");
/**
* Enqueue block stylesheets.
*/
if ( ! function_exists( 'simplenet_block_stylesheets' ) ) :
/**
* Enqueue custom block stylesheets
*
* @since Simplenet 1.0
* @return void
*/
function simplenet_block_stylesheets() {
$simplenet_styled_blocks = array(
'core/list' => 'list',
'core/details' => 'details',
'core/search' => 'search',
"core/columns" => "columns",
);
foreach ( $simplenet_styled_blocks as $block_name_with_namespace => $block_name ) {
wp_enqueue_block_style(
$block_name_with_namespace,
array(
'handle' => 'simplenet-' . $block_name,
'src' => get_template_directory_uri() . '/assets/css/blocks/' . $block_name . '.css',
'path' => get_template_directory() . '/assets/css/blocks/' . $block_name . '.css',
)
);
}
}
endif;
add_action( 'init', 'simplenet_block_stylesheets' );