-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
100 lines (82 loc) · 3 KB
/
Copy pathfunctions.php
File metadata and controls
100 lines (82 loc) · 3 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
<?php
use Roots\Acorn\Application;
use App\Helpers\SleipnirMetaTagger;
use App\Helpers\SleipnirWebpConverter;
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our theme. We will simply require it into the script here so that we
| don't have to worry about manually loading any of our classes later on.
|
*/
if (! file_exists($composer = __DIR__.'/vendor/autoload.php')) {
wp_die(__('Error locating autoloader. Please run <code>composer install</code>.', 'sage'));
}
require $composer;
/*
|--------------------------------------------------------------------------
| Register The Bootloader
|--------------------------------------------------------------------------
|
| The first thing we will do is schedule a new Acorn application container
| to boot when WordPress is finished loading the theme. The application
| serves as the "glue" for all the components of Laravel and is
| the IoC container for the system binding all of the various parts.
|
*/
Application::configure()
->withProviders([
App\Providers\ThemeServiceProvider::class,
])
->boot();
/*
|--------------------------------------------------------------------------
| Register Sage Theme Files
|--------------------------------------------------------------------------
|
| Out of the box, Sage ships with categorically named theme files
| containing common functionality and setup to be bootstrapped with your
| theme. Simply add (or remove) files from the array below to change what
| is registered alongside Sage.
|
*/
collect(['setup', 'filters'])
->each(function ($file) {
if (! locate_template($file = "app/{$file}.php", true, true)) {
wp_die(
/* translators: %s is replaced with the relative file path */
sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file)
);
}
});
/*
|--------------------------------------------------------------------------
| Xolof's custom adaptations
|--------------------------------------------------------------------------
*/
/**
* Remove Custom CSS section in admin.
*/
add_action("customize_register", function ($wp_customize)
{
$wp_customize->remove_section("custom_css");
});
/** Remove dashicons */
add_action("wp_print_styles", "liberdev_deregister_styles", 100);
function liberdev_deregister_styles()
{
if (!is_user_logged_in()) {
wp_deregister_style("dashicons");
}
}
// Add meta tags.
$metaTagger = new SleipnirMetaTagger();
add_action( 'wp_head', [$metaTagger, 'add_meta_tags']);
$webPConverter = new SleipnirWebpConverter();
// Convert images to WebP format on upload
add_filter('wp_handle_upload', [$webPConverter, 'convert_to_webp_on_upload']);
// Add filter for generating metadata for WebP files.
add_filter('wp_generate_attachment_metadata', [$webPConverter, 'update_webp_metadata'], 10, 2);