2023-07-25 13:51:08 -07:00

96 lines
2.7 KiB
PHP

<?php
/**
* chucktheme's functions and definitions
*
* @package chucktheme
* @since chucktheme 1.0
*/
/**
* First, let's set the maximum content width based on the theme's
* design and stylesheet.
* This will limit the width of all uploaded images and embeds.
*/
if (!isset($content_width)) {
$content_width = 800; /* pixels */
}
if (!function_exists('chucktheme_setup')) :
/**
* Sets up theme defaults and registers support for various
* WordPress features.
*
* Note that this function is hooked into the after_setup_theme
* hook, which runs before the init hook. The init hook is too late
* for some features, such as indicating support post thumbnails.
*/
function chucktheme_setup()
{
// /**
// * Make theme available for translation.
// * Translations can be placed in the /languages/ directory.
// */
// load_theme_textdomain( 'chucktheme', get_template_directory() . '/languages' );
// /**
// * Add default posts and comments RSS feed links to <head>.
// */
// add_theme_support( 'automatic-feed-links' );
// /**
// * Enable support for post thumbnails and featured images.
// */
// add_theme_support( 'post-thumbnails' );
// /**
// * Add support for two custom navigation menus.
// */
// register_nav_menus( array(
// 'primary' => __( 'Primary Menu', 'chucktheme' ),
// 'secondary' => __( 'Secondary Menu', 'chucktheme' ),
// ) );
// /**
// * Enable support for the following post formats:
// * aside, gallery, quote, image, and video
// */
// add_theme_support( 'post-formats', array( 'aside', 'gallery', 'quote', 'image', 'video' ) );
$styled_blocks = ['post-title'];
foreach ($styled_blocks as $block_name) {
$args = array(
'handle' => "myfirsttheme-$block_name",
'src' => get_theme_file_uri("assets/css/blocks/$block_name.css"),
$args['path'] = get_theme_file_path("assets/css/blocks/$block_name.css"),
);
wp_enqueue_block_style("core/$block_name", $args);
}
add_theme_support('align-wide');
// add_filter('render_block', function ($blockContent, $block) {
// if ($block['blockName'] !== 'core/post-title') {
// return $blockContent;
// }
// $pattern = '/(<h[^>]*>)(.*)(<\/h[1-7]{1}>)/i';
// $replacement = '$1<span>$2</span>$3';
// return preg_replace($pattern, $replacement, $blockContent);
// }, 10, 2);
}
endif; // chucktheme_setup
add_action('after_setup_theme', 'chucktheme_setup');
if (!function_exists('chucktheme_enqueue')) :
function chucktheme_enqueue()
{
wp_enqueue_style('style', get_stylesheet_uri());
}
endif;
add_action('wp_enqueue_scripts', 'chucktheme_enqueue');