-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
101 lines (82 loc) · 2.22 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
<?php
/**
* This file adds functions to the Séance WordPress theme.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package seance
* @author Alex de Borba
* @license GNU General Public License v2 or later
* @link https://github.com/alexdeborba/seance/
* @since 1.0.0
*/
if ( ! function_exists( 'seance_support' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 1.0.0
*
* @return void
*/
function seance_support() {
// Adds support for block styles.
add_theme_support( 'wp-block-styles' );
// Enqueue block editor styles.
add_editor_style( 'style.css' );
// Remove support for WordPress default block patterns.
remove_theme_support( 'core-block-patterns' );
}
endif;
add_action( 'after_setup_theme', 'seance_support' );
if ( ! function_exists( 'seance_styles' ) ) :
/**
* Enqueue theme styles.
*
* @since 1.0.0
*
* @return void
*/
function seance_styles() {
// Register theme stylesheet.
$theme_version = wp_get_theme()->get( 'Version' );
$version_string = is_string( $theme_version ) ? $theme_version : false;
wp_register_style(
'seance-style',
get_template_directory_uri() . '/style.css',
array(),
$version_string
);
// Enqueue theme stylesheet.
wp_enqueue_style( 'seance-style' );
}
endif;
add_action( 'wp_enqueue_scripts', 'seance_styles' );
// Register pattern categories.
function pattern_categories() {
$block_pattern_categories = array(
'post' => array(
'label' => __( 'Post', 'seance' ),
),
'pages' => array(
'label' => __( 'Pages', 'seance' ),
),
'gallery' => array(
'label' => __( 'Gallery', 'seance' ),
),
'query' => array(
'label' => __( 'Query', 'seance' ),
),
'footer' => array(
'label' => __( 'Footer', 'seance' ),
),
);
foreach ( $block_pattern_categories as $name => $properties ) {
register_block_pattern_category( $name, $properties );
}
}
add_action( 'init', __NAMESPACE__ . '\pattern_categories', 9 );
// Prevent loading patterns from the WordPress.org pattern directory.
function seance_prevent_remote_patterns() {
return false;
}
add_filter( 'should_load_remote_block_patterns', 'seance_prevent_remote_patterns' );