forked from Nerko69/powder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
94 lines (80 loc) · 2.13 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
<?php
/**
* This file adds functions to the Powder WordPress theme.
*
* @package Powder
* @author Brian Gardner
* @license GNU General Public License v2 or later
* @link https://briangardner.com/
*/
if ( ! function_exists( 'powder_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.
*
* @since 0.5.0
*/
function powder_setup() {
// Make theme available for translation.
load_theme_textdomain( 'powder', get_template_directory() . '/languages' );
// Enqueue editor styles.
add_editor_style( get_template_directory_uri() . '/style.css' );
// 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', 'powder_setup' );
/**
* Enqueue theme style sheet.
*
* @since 0.5.0
*/
function powder_enqueue_style_sheet() {
wp_enqueue_style(
'powder',
get_template_directory_uri() . '/style.css',
array(),
wp_get_theme( 'powder' )->get( 'Version' )
);
}
add_action( 'wp_enqueue_scripts', 'powder_enqueue_style_sheet' );
/**
* Register block styles.
*
* @since 0.5.0
*/
function powder_register_block_styles() {
$block_styles = array(
'core/group' => array(
'full-height' => __( 'Full-height', 'powder' ),
'shadow' => __( 'Shadow', 'powder' ),
'shadow-solid' => __( 'Shadow Solid', 'powder' ),
),
'core/image' => array(
'shadow' => __( 'Shadow', 'powder' ),
'shadow-solid' => __( 'Shadow Solid', 'powder' ),
),
'core/list' => array(
'no-disc' => __( 'No Disc', 'powder' ),
),
'core/navigation-link' => array(
'outline' => __( 'Outline', 'powder' ),
),
);
foreach ( $block_styles as $block => $styles ) {
foreach ( $styles as $style_name => $style_label ) {
register_block_style(
$block,
array(
'name' => $style_name,
'label' => $style_label,
)
);
}
}
}
add_action( 'init', 'powder_register_block_styles' );