-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfunctions.php
More file actions
81 lines (70 loc) · 2.64 KB
/
Copy pathfunctions.php
File metadata and controls
81 lines (70 loc) · 2.64 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
<?php
declare(strict_types=1);
/**
* ------------------------------------------------------------------------------
* Theme configuration
*
* - Composer autoloader
* - Register assets
* - Optimize WordPress output
* ------------------------------------------------------------------------------
*/
use RalfHortt\Assets\Script;
use RalfHortt\Assets\Style;
use RalfHortt\WPBlock\BlockManifest;
/**
* ------------------------------------------------------------------------------
* Autoloader
*
* Load composer autoloader file
* ------------------------------------------------------------------------------
*/
$autoloader = __DIR__.'/vendor/autoload.php';
if (is_readable($autoloader)) {
include $autoloader;
}
if (! defined('WPINC')) {
return;
}
/**
* ------------------------------------------------------------------------------
* Setup theme
* ------------------------------------------------------------------------------
*/
add_action('after_setup_theme', function (): void {
/**
* ------------------------------------------------------------------------------
* Setup theme support features
*
* @see https://developer.wordpress.org/block-editor/developers/themes/theme-support/
* @see https://developer.wordpress.org/reference/functions/add_theme_support/
* ------------------------------------------------------------------------------
*/
add_editor_style('build/assets/editor-styles.scss.css');
/**
* ------------------------------------------------------------------------------
* Assets management
*
* @see https://github.com/Horttcore/wp-assets
* ------------------------------------------------------------------------------
*/
(new Script('theme', get_template_directory_uri().'/build/assets/app.ts.js', [], true))->register();
(new Style('theme', get_template_directory_uri().'/build/assets/app.scss.css', []))->register();
/**
* ------------------------------------------------------------------------------
* Register blocks from a manifest file
*
* @see https://github.com/Horttcore/wp-block
* ------------------------------------------------------------------------------
*/
// (new BlockManifest(__DIR__.'/build/blocks/blocks-manifest.php'))->register();
});
/**
* Register per-block custom styles from manifest
*/
require_once get_template_directory().'/inc/blocks/block-styles-registration.php';
/**
* ------------------------------------------------------------------------------
* Put project specific code in functions.custom.php
* ------------------------------------------------------------------------------
*/