This repository was archived by the owner on Feb 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 359
Expand file tree
/
Copy pathfunctions.php
More file actions
138 lines (119 loc) · 3.23 KB
/
functions.php
File metadata and controls
138 lines (119 loc) · 3.23 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
<?php
/**
* Assembler functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Assembler
* @since Assembler 1.0
*/
declare( strict_types = 1 );
if ( ! function_exists( 'assembler_unregister_patterns' ) ) :
/**
* Unregister Jetpack patterns and core patterns bundled in WordPress.
*/
function assembler_unregister_patterns() {
$pattern_names = array(
// Jetpack form patterns.
'contact-form',
'newsletter-form',
'rsvp-form',
'registration-form',
'appointment-form',
'feedback-form',
// Patterns bundled in WordPress core.
// These would be removed by remove_theme_support( 'core-block-patterns' )
// if it's called on the init action with priority 9 from a plugin, not from a theme.
'core/query-standard-posts',
'core/query-medium-posts',
'core/query-small-posts',
'core/query-grid-posts',
'core/query-large-title-posts',
'core/query-offset-posts',
'core/social-links-shared-background-color',
);
foreach ( $pattern_names as $pattern_name ) {
$pattern = \WP_Block_Patterns_Registry::get_instance()->get_registered( $pattern_name );
if ( $pattern ) {
unregister_block_pattern( $pattern_name );
}
}
}
endif;
if ( ! function_exists( 'assembler_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since Assembler 1.0
*
* @return void
*/
function assembler_setup() {
// Enqueue editor styles.
add_editor_style( 'style.css' );
// Unregister Jetpack form patterns and core patterns bundled in WordPress.
// Simple sites
assembler_unregister_patterns();
add_filter( 'wp_loaded', function () {
// Atomic sites
assembler_unregister_patterns();
} );
// Remove theme support for the core and featured patterns coming from the Dotorg pattern directory.
remove_theme_support( 'core-block-patterns' );
}
endif;
add_action( 'after_setup_theme', 'assembler_setup' );
if ( ! function_exists( 'assembler_styles' ) ) :
/**
* Enqueue styles.
*
* @since Assembler 1.0
*
* @return void
*/
function assembler_styles() {
// Register theme stylesheet.
wp_register_style(
'assembler-style',
get_stylesheet_directory_uri() . '/style.css',
array(),
wp_get_theme()->get( 'Version' )
);
// Enqueue theme stylesheet.
wp_enqueue_style( 'assembler-style' );
}
endif;
add_action( 'wp_enqueue_scripts', 'assembler_styles' );
if ( ! function_exists( 'assembler_register_pattern_categories' ) ) :
/**
* Register pattern categories.
*
* @since Assembler 1.0
*
* @return void
*/
function assembler_register_pattern_categories() {
register_block_pattern_category(
'page',
array( 'label' => __( 'Pages', 'assembler' ) )
);
register_block_pattern_category(
'intro',
array( 'label' => __( 'Intro', 'assembler' ) )
);
register_block_pattern_category(
'services',
array( 'label' => __( 'Services', 'assembler' ) )
);
register_block_pattern_category(
'about',
array( 'label' => __( 'About', 'assembler' ) )
);
register_block_pattern_category(
'social',
array( 'label' => __( 'Social', 'assembler' ) )
);
}
endif;
// Add this new action
add_action( 'init', 'assembler_register_pattern_categories' );