lex-scotland-theme/functions.php

82 lines
2.5 KiB
PHP
Raw Normal View History

2024-05-08 09:26:54 +00:00
<?php
add_action('init', 'custom_stylesheet');
function custom_stylesheet() {
wp_register_style( 'custom-styles', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'custom-styles' );
}
add_action( 'wp_enqueue_scripts', 'custom_stylesheet' );
2024-05-11 17:27:56 +00:00
add_action( 'init', 'lex_scotland_block_styles');
function lex_scotland_block_styles() {
register_block_style( 'core/button', array(
'name' => 'thin',
'label' => __( 'Thin', 'lex-scotland' ),
'inline_style' => '
.wp-block-button.is-style-thin .wp-element-button {
padding: 8px 16px;
2024-06-05 12:46:15 +00:00
background: var(--wp--preset--color--washed-green);
2024-05-11 17:27:56 +00:00
color: var(--wp--preset--color--contrast);
border-radius: 0;
font-size: var(--wp--preset--font-size--small);
2024-06-05 12:46:15 +00:00
border: 1px solid var(--wp--preset--color--washed-green);
2024-06-05 16:17:08 +00:00
font-weight: 400;
2024-05-13 09:42:15 +00:00
}
.wp-block-button.is-style-thin .wp-element-button:hover {
border: 1px dashed;
2024-05-11 17:27:56 +00:00
}
'
) );
2024-05-13 11:36:25 +00:00
2024-06-05 13:05:47 +00:00
register_block_style( 'core/paragraph', array(
'name' => 'arrow-link',
'label' => __( 'Arrow link', 'lex-scotland' ),
'inline_style' => '
p.is-style-arrow-link a:after {
display: inline-block;
content: "🡭";
padding-inline-start: 0.25rem;
vertical-align: middle;
}
'
) );
2024-05-13 11:36:25 +00:00
register_block_style( 'core/paragraph', array(
'name' => 'constrained',
'label' => __( 'Constrained', 'lex-scotland' ),
'inline_style' => '
p.is-style-constrained {
max-width: 50ch;
2024-05-13 11:36:25 +00:00
}
'
) );
2024-05-13 11:39:22 +00:00
register_block_style( 'core/list-item', array(
'name' => 'constrained',
'label' => __( 'Constrained', 'lex-scotland' ),
'inline_style' => '
li.is-style-constrained {
max-width: 50ch;
2024-05-13 11:39:22 +00:00
}
'
) );
2024-06-12 02:35:52 +00:00
}
// enable customizer
2024-06-12 09:13:25 +00:00
add_action( 'customize_register', '__return_true' );
// add full page pattern category
2024-06-12 09:14:55 +00:00
function lexscotland_pattern_categories() {
2024-06-12 09:13:25 +00:00
register_block_pattern_category(
'lexscotland_page',
array(
'label' => _x( 'Pages', 'Block pattern category', 'lexscotland' ),
'description' => __( 'A collection of full page layouts.', 'lexscotland' ),
)
);
}
add_action( 'init', 'lexscotland_pattern_categories' );