2021-12-16 19:15:30 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2022-01-11 17:51:19 +00:00
|
|
|
* Livro functions and definitions
|
2021-12-16 19:15:30 +00:00
|
|
|
*
|
|
|
|
* @link https://developer.wordpress.org/themes/basics/theme-functions/
|
|
|
|
*
|
2022-01-14 12:42:40 +00:00
|
|
|
* @package Livro
|
2022-01-11 17:51:19 +00:00
|
|
|
* @since Livro 1.0
|
2021-12-16 19:15:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2022-01-11 17:51:19 +00:00
|
|
|
if ( ! function_exists( 'livro_support' ) ) :
|
2021-12-16 19:15:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up theme defaults and registers support for various WordPress features.
|
|
|
|
*
|
2022-01-11 17:51:19 +00:00
|
|
|
* @since Livro 1.0
|
2021-12-16 19:15:30 +00:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-01-11 17:51:19 +00:00
|
|
|
function livro_support() {
|
2022-10-28 15:43:41 +00:00
|
|
|
// Make theme available for translation.
|
|
|
|
load_theme_textdomain( 'livro' );
|
2021-12-16 19:15:30 +00:00
|
|
|
|
|
|
|
// Add support for block styles.
|
|
|
|
add_theme_support( 'wp-block-styles' );
|
|
|
|
|
2022-03-23 16:24:26 +00:00
|
|
|
// Support the "Aside" post format.
|
|
|
|
add_theme_support( 'post-formats', array( 'aside' ) );
|
|
|
|
|
2021-12-16 19:15:30 +00:00
|
|
|
// Enqueue editor styles.
|
|
|
|
add_editor_style( 'style.css' );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
endif;
|
|
|
|
|
2022-01-11 17:51:19 +00:00
|
|
|
add_action( 'after_setup_theme', 'livro_support' );
|
2021-12-16 19:15:30 +00:00
|
|
|
|
2022-01-11 17:51:19 +00:00
|
|
|
if ( ! function_exists( 'livro_styles' ) ) :
|
2021-12-16 19:15:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enqueue styles.
|
|
|
|
*
|
2022-01-11 17:51:19 +00:00
|
|
|
* @since Livro 1.0
|
2021-12-16 19:15:30 +00:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-01-11 17:51:19 +00:00
|
|
|
function livro_styles() {
|
2021-12-16 19:15:30 +00:00
|
|
|
|
|
|
|
// Register theme stylesheet.
|
|
|
|
wp_register_style(
|
2022-01-11 17:51:19 +00:00
|
|
|
'livro-style',
|
2021-12-16 19:15:30 +00:00
|
|
|
get_template_directory_uri() . '/style.css',
|
|
|
|
array(),
|
|
|
|
wp_get_theme()->get( 'Version' )
|
|
|
|
);
|
|
|
|
|
|
|
|
// Enqueue theme stylesheet.
|
2022-01-11 17:51:19 +00:00
|
|
|
wp_enqueue_style( 'livro-style' );
|
2021-12-16 19:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
endif;
|
|
|
|
|
2022-01-11 17:51:19 +00:00
|
|
|
add_action( 'wp_enqueue_scripts', 'livro_styles' );
|
2021-12-16 19:15:30 +00:00
|
|
|
|
2022-04-20 09:44:13 +00:00
|
|
|
require get_template_directory() . '/inc/gutenberg-dependency-check.php';
|
2022-03-23 16:24:51 +00:00
|
|
|
|
2022-04-20 09:44:13 +00:00
|
|
|
/**
|
|
|
|
* Registers block patterns and categories.
|
|
|
|
*
|
|
|
|
* @since Livro 1.0
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function livro_register_block_pattern_categories() {
|
|
|
|
|
|
|
|
//Needed until https://github.com/WordPress/gutenberg/issues/39500 is fixed.
|
|
|
|
$block_pattern_categories = array(
|
2022-10-28 15:43:41 +00:00
|
|
|
'pages' => array( 'label' => __( 'Pages', 'livro' ) ),
|
|
|
|
'footer' => array( 'label' => __( 'Footers', 'livro' ) ),
|
|
|
|
'header' => array( 'label' => __( 'Headers', 'livro' ) ),
|
2022-04-20 09:44:13 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Filters the theme block pattern categories.
|
|
|
|
*
|
|
|
|
* @since Livro 1.0
|
|
|
|
*
|
|
|
|
* @param array[] $block_pattern_categories {
|
|
|
|
* An associative array of block pattern categories, keyed by category name.
|
|
|
|
*
|
|
|
|
* @type array[] $properties {
|
|
|
|
* An array of block category properties.
|
|
|
|
*
|
|
|
|
* @type string $label A human-readable label for the pattern category.
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
$block_pattern_categories = apply_filters( 'livro_block_pattern_categories', $block_pattern_categories );
|
|
|
|
|
|
|
|
foreach ( $block_pattern_categories as $name => $properties ) {
|
|
|
|
if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
|
|
|
|
register_block_pattern_category( $name, $properties );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
add_action( 'init', 'livro_register_block_pattern_categories', 9 );
|