-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
75 lines (67 loc) · 1.67 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
<?php
/**
* Functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package hizzle
* @since 1.0.0
*/
/**
* The theme version.
*
* @since 1.0.0
*/
define( 'HIZZLE_VERSION', wp_get_theme()->get( 'Version' ) );
/**
* Add theme support for block styles and editor style.
*
* @since 1.0.0
*
* @return void
*/
function hizzle_setup() {
add_editor_style( './assets/css/style.css' );
/*
* Load additional block styles.
* See details on how to add more styles in the readme.txt.
*/
$styled_blocks = [ 'button', 'quote' ];
foreach ( $styled_blocks as $block_name ) {
$args = array(
'handle' => "hizzle-$block_name",
'src' => get_theme_file_uri( "assets/css/$block_name-block.css" ),
'path' => get_theme_file_path( "assets/css/$block_name-block.css" ),
);
// Replace the "core" prefix if you are styling blocks from plugins.
wp_enqueue_block_style( "core/$block_name", $args );
}
}
add_action( 'after_setup_theme', 'hizzle_setup' );
/**
* Enqueue the CSS files.
*
* @since 1.0.0
*
* @return void
*/
function hizzle_styles() {
$version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : HIZZLE_VERSION;
wp_enqueue_style(
'hizzle-styles',
get_theme_file_uri( 'assets/css/style.css' ),
[],
$version
);
if ( function_exists( 'is_woocommerce' ) && ( is_woocommerce() || is_cart() || is_checkout() || is_account_page() ) ) {
wp_enqueue_style(
'hizzle-woocommerce',
get_theme_file_uri( 'assets/css/woocommerce.css' ),
[],
$version
);
}
}
add_action( 'wp_enqueue_scripts', 'hizzle_styles' );
// Block style examples.
require_once get_theme_file_path( 'inc/register-block-styles.php' );