<?php /** * Nion functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Nion * @since Nion 1.0 */ declare( strict_types = 1 ); if ( ! function_exists( 'nion_support' ) ) : /** * Sets up theme defaults and registers support for various WordPress functionalities. * * @since Nion 1.0 * @return void */ function nion_support() { // Enqueue editor styles. add_editor_style( 'style.css' ); // Make theme available for translation. load_theme_textdomain( 'nion' ); } endif; add_action( 'after_setup_theme', 'nion_support' ); if ( ! function_exists( 'nion_styles' ) ) : /** * Enqueue styles. * * @since Nion 1.0 * @return void */ function nion_styles() { // Register theme stylesheet. wp_register_style( 'nion-style', get_stylesheet_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); // Enqueue theme stylesheet. wp_enqueue_style( 'nion-style' ); } endif; add_action( 'wp_enqueue_scripts', 'nion_styles' ); if ( ! function_exists( 'nion_block_styles' ) ) : /** * Register custom block styles * * @since Nion 1.0 * @return void */ function nion_block_styles() { register_block_style( 'core/button', array( 'name' => 'glow', 'label'=> __( 'Glow', 'nion' ) ) ); register_block_style( 'core/heading', array( 'name' => 'glow', 'label'=> __( 'Glow', 'nion' ) ) ); register_block_style( 'core/heading', array( 'name' => 'glow-cursive', 'label'=> __( 'Glow Cursive', 'nion' ) ) ); register_block_style( 'core/post-terms', array( 'name'=> 'pill', 'label'=> __( 'Pill', 'nion' ), ) ); register_block_style( 'core/post-title', array( 'name' => 'glow', 'label'=> __( 'Glow', 'nion' ) ) ); register_block_style( 'core/post-title', array( 'name' => 'glow-cursive', 'label'=> __( 'Glow Cursive', 'nion' ) ) ); register_block_style( 'core/query-title', array( 'name' => 'glow', 'label'=> __( 'Glow', 'nion' ) ) ); register_block_style( 'core/query-title', array( 'name' => 'glow-cursive', 'label'=> __( 'Glow Cursive', 'nion' ) ) ); register_block_style( 'core/site-title', array( 'name' => 'glow', 'label'=> __( 'Glow', 'nion' ) ) ); register_block_style( 'core/site-title', array( 'name' => 'glow-cursive', 'label'=> __( 'Glow Cursive', 'nion' ) ) ); register_block_style( 'core/separator', array( 'name' => 'glow', 'label'=> __( 'Glow', 'nion' ) ) ); } endif; add_action( 'init', 'nion_block_styles' ); if ( ! function_exists( 'nion_block_stylesheets' ) ) : /** * Enqueue custom block stylesheets * * @since Nion 1.0 * @return void */ function nion_block_stylesheets() { $nion_styled_blocks = array( 'core/archives' => 'archives', 'core/audio' => 'audio', 'core/button' => 'button', 'core/calendar' => 'calendar', 'core/categories' => 'categories', 'core/comment-content' => 'comment-content', 'core/comments-pagination' => 'comments-pagination', 'core/embed' => 'embed', 'core/heading' => 'heading', 'core/image' => 'image', 'core/latest-comments' => 'latest-comments', 'core/latest-posts' => 'latest-posts', 'core/page-list' => 'page-list', 'core/post-author' => 'post-author', 'core/post-comments-form' => 'post-comments-form', 'core/post-excerpt' => 'post-excerpt', 'core/post-terms' => 'post-terms', 'core/post-title' => 'post-title', 'core/pullquote' => 'pullquote', 'core/query-pagination-next' => 'query-pagination-next', 'core/query-pagination-numbers' => 'query-pagination-numbers', 'core/query-pagination-previous' => 'query-pagination-previous', 'core/query-title' => 'query-title', 'core/quote' => 'quote', 'core/search' => 'search', 'core/separator' => 'separator', 'core/site-title' => 'site-title', 'core/table' => 'table', 'core/tag-cloud' => 'tag-cloud', 'core/term-description' => 'term-description', 'core/video' => 'video' ); foreach ( $nion_styled_blocks as $block_name_with_namespace => $block_name ) { wp_enqueue_block_style( $block_name_with_namespace, array( 'handle' => 'nion-' . $block_name, 'src' => get_template_directory_uri() . '/assets/css/blocks/' . $block_name . '.css', 'path' => get_template_directory() . '/assets/css/blocks/' . $block_name . '.css', ) ); } } endif; add_action( 'init', 'nion_block_stylesheets' );