40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Phosphor — theme setup.
|
|
*
|
|
* A block theme needs very little PHP: enqueue the supplemental stylesheet,
|
|
* load the text domain, and add a body class for the optional scanline overlay.
|
|
*
|
|
* @package Phosphor
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) exit;
|
|
|
|
add_action('after_setup_theme', function (): void {
|
|
load_theme_textdomain('phosphor', get_template_directory() . '/languages');
|
|
add_theme_support('wp-block-styles');
|
|
add_theme_support('responsive-embeds');
|
|
add_theme_support('editor-styles');
|
|
add_editor_style('style.css');
|
|
});
|
|
|
|
add_action('wp_enqueue_scripts', function (): void {
|
|
$css = get_stylesheet_directory() . '/style.css';
|
|
wp_enqueue_style(
|
|
'phosphor',
|
|
get_stylesheet_uri(),
|
|
[],
|
|
file_exists($css) ? (string) filemtime($css) : '0.1.0'
|
|
);
|
|
});
|
|
|
|
/**
|
|
* Toggle the CRT scanline overlay with: add_filter('phosphor_scanlines', '__return_true');
|
|
* Off by default so it never surprises a buyer.
|
|
*/
|
|
add_filter('body_class', function (array $classes): array {
|
|
if (apply_filters('phosphor_scanlines', false)) {
|
|
$classes[] = 'phosphor-scanlines';
|
|
}
|
|
return $classes;
|
|
});
|