forked from andersnoren/bjork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
83 lines (63 loc) · 2.9 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
<?php
/* -----------------------------------------------------------------------------------------------
THEME SUPPORTS
--------------------------------------------------------------------------------------------------- */
function bjork_setup() {
add_editor_style( 'style.css' );
}
add_action( 'after_setup_theme', 'bjork_setup' );
/* -----------------------------------------------------------------------------------------------
ENQUEUE STYLESHEETS
--------------------------------------------------------------------------------------------------- */
function bjork_styles() {
wp_enqueue_style( 'bjork-styles', get_theme_file_uri( '/style.css' ), array(), wp_get_theme( 'bjork' )->get( 'Version' ) );
}
add_action( 'wp_enqueue_scripts', 'bjork_styles' );
/* -----------------------------------------------------------------------------------------------
BLOCK PATTERNS
Register theme specific block pattern categories. The patterns themselves are stored in /patterns/.
--------------------------------------------------------------------------------------------------- */
function bjork_register_block_patterns() {
if ( ! function_exists( 'register_block_pattern_category' ) ) return;
// The block pattern categories included in Björk.
$bjork_block_pattern_categories = apply_filters( 'bjork_block_pattern_categories', array(
'bjork-blog' => array(
'label' => esc_html__( 'Björk Blog', 'bjork' ),
),
'bjork-cta' => array(
'label' => esc_html__( 'Björk Call to Action', 'bjork' ),
),
'bjork-general' => array(
'label' => esc_html__( 'Björk General', 'bjork' ),
),
) );
// Sort the block pattern categories alphabetically based on the label value, to ensure alphabetized order when the strings are localized.
uasort( $bjork_block_pattern_categories, function( $a, $b ) {
return strcmp( $a["label"], $b["label"] ); }
);
// Register block pattern categories.
foreach ( $bjork_block_pattern_categories as $slug => $settings ) {
register_block_pattern_category( $slug, $settings );
}
}
add_action( 'init', 'bjork_register_block_patterns' );
/* -----------------------------------------------------------------------------------------------
BLOCK STYLES
Register theme specific block styles.
--------------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'bjork_register_block_styles' ) ) :
function bjork_register_block_styles() {
if ( ! function_exists( 'register_block_style' ) ) return;
// Separator: Angled Separator
register_block_style( 'core/separator', array(
'name' => 'bjork-angled-separator',
'label' => esc_html__( 'Angled', 'bjork' ),
) );
// Separator: Angled Separator Wide
register_block_style( 'core/separator', array(
'name' => 'bjork-angled-separator-wide',
'label' => esc_html__( 'Angled Wide', 'bjork' ),
) );
}
add_action( 'init', 'bjork_register_block_styles' );
endif;