-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
136 lines (110 loc) · 4.69 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/* -----------------------------------------------------------------------------------------------
THEME SUPPORTS
--------------------------------------------------------------------------------------------------- */
function abisko_setup() {
add_editor_style( 'style.css' );
}
add_action( 'after_setup_theme', 'abisko_setup' );
/* -----------------------------------------------------------------------------------------------
ENQUEUE STYLESHEETS
--------------------------------------------------------------------------------------------------- */
function abisko_styles() {
wp_enqueue_style( 'abisko-styles', get_template_directory_uri() . '/style.css', array(), wp_get_theme( 'abisko' )->get( 'Version' ) );
}
add_action( 'wp_enqueue_scripts', 'abisko_styles' );
/* -----------------------------------------------------------------------------------------------
BLOCK PATTERNS
Register theme specific block pattern categories. The patterns themselves are stored in /patterns/.
--------------------------------------------------------------------------------------------------- */
function abisko_register_block_patterns() {
// The block pattern categories included in Abisko.
$abisko_block_pattern_categories = apply_filters( 'abisko_block_pattern_categories', array(
'abisko' => array(
'label' => esc_html__( 'Abisko - All', 'abisko' ),
),
'abisko-blog' => array(
'label' => esc_html__( 'Abisko - Blog', 'abisko' ),
),
'abisko-cta' => array(
'label' => esc_html__( 'Abisko - Call to Action', 'abisko' ),
),
'abisko-general' => array(
'label' => esc_html__( 'Abisko - General', 'abisko' ),
),
'abisko-hero' => array(
'label' => esc_html__( 'Abisko - Hero', 'abisko' ),
),
'abisko-media' => array(
'label' => esc_html__( 'Abisko - Media', 'abisko' ),
),
'abisko-page' => array(
'label' => esc_html__( 'Abisko - Page Layouts', 'abisko' ),
),
) );
// Sort the block pattern categories alphabetically based on the label value, to ensure alphabetized order when the strings are localized.
uasort( $abisko_block_pattern_categories, function( $a, $b ) {
return strcmp( $a["label"], $b["label"] ); }
);
// Register block pattern categories.
foreach ( $abisko_block_pattern_categories as $slug => $settings ) {
register_block_pattern_category( $slug, $settings );
}
}
add_action( 'init', 'abisko_register_block_patterns' );
/* -----------------------------------------------------------------------------------------------
FILTER COMMENT FORM DEFAULTS
Modify the heading and title of the comments form.
--------------------------------------------------------------------------------------------------- */
function abisko_comment_form_defaults( $defaults ) {
return array_merge( $defaults, array(
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h2>',
'title_reply' => __( 'Reply', 'abisko' )
) );
}
add_filter( 'comment_form_defaults', 'abisko_comment_form_defaults' );
/* -----------------------------------------------------------------------------------------------
BLOCK STYLES
Register theme specific block styles.
--------------------------------------------------------------------------------------------------- */
function abisko_register_block_styles() {
// Column: -90° Contents On Desktop
register_block_style( 'core/column', array(
'name' => 'abisko-minus-90-deg-column-content-desktop',
'label' => esc_html__( '-90° Contents On Desktop', 'abisko' ),
) );
// Cover: Background Blur
register_block_style( 'core/cover', array(
'name' => 'abisko-bg-blur',
'label' => esc_html__( 'Overlay Blur', 'abisko' ),
) );
// Featured Image: Ratio: 1/1
register_block_style( 'core/post-featured-image', array(
'name' => 'abisko-ar-1x1',
'label' => esc_html__( 'Ratio: 1/1', 'abisko' ),
) );
// Featured Image: Ratio: 4/3
register_block_style( 'core/post-featured-image', array(
'name' => 'abisko-ar-4x3',
'label' => esc_html__( 'Ratio: 4/3', 'abisko' ),
) );
// Heading, Paragraph: Tabular Numerals
foreach( array( 'core/heading', 'core/paragraph' ) as $block_name ) {
register_block_style( $block_name, array(
'name' => 'abisko-tabular-nums',
'label' => esc_html__( 'Tabular Numerals', 'abisko' ),
) );
}
// Post Comments Form: Rotated Title to the Right on Desktop
register_block_style( 'core/post-comments-form', array(
'name' => 'abisko-rotated-title',
'label' => esc_html__( 'Rotated Title to the Right on Desktop', 'abisko' ),
) );
// Term: Buttons
register_block_style( 'core/post-terms', array(
'name' => 'abisko-terms-buttons',
'label' => esc_html__( 'Buttons', 'abisko' ),
) );
}
add_action( 'init', 'abisko_register_block_styles' );