HEX
Server: Apache
System: FreeBSD www860.sakura.ne.jp 13.0-RELEASE-p14 FreeBSD 13.0-RELEASE-p14 #2: Mon Dec 9 13:54:55 JST 2024 root@www5301.sakura.ne.jp:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
User: yoyo0427 (1306)
PHP: 8.3.8
Disabled: NONE
Upload Files
File: /home/yoyo0427/www/www.yn-artspace.com/wp-content/themes/blockbase/inc/block-patterns.php
<?php
/**
 * Blockbase Theme: Block Patterns
 *
 * @package Blockbase
 */
if ( ! function_exists( 'blockbase_register_block_patterns' ) ) :

	function blockbase_register_block_patterns() {

		if ( function_exists( 'register_block_pattern_category' ) ) {
			register_block_pattern_category(
				'blockbase',
				array( 'label' => __( 'Blockbase', 'blockbase' ) )
			);
		}

		if ( function_exists( 'register_block_pattern' ) ) {
			$block_patterns = array(
				'404',
				'footer-columns',
				'footer-left',
				'footer-primary',
				'footer-search',
				'footer-separator',
				'footer-simple',
				'footer-small',
				'footer-with-site-title',
			);

			foreach ( $block_patterns as $block_pattern ) {
				register_block_pattern(
					'blockbase/' . $block_pattern,
					require __DIR__ . '/patterns/' . $block_pattern . '.php'
				);
			}

			//register header templates also as patterns
			$header_patterns = array(
				'centered',
				'default',
				'linear',
				'minimal',
				'rounded-logo',
				'wide',
			);

			foreach ( $header_patterns as $header_pattern ) {
				register_block_pattern(
					'blockbase/header-' . $header_pattern,
					array(
						'title'      => __( 'Blockbase Header (' . $header_pattern . ')', 'blockbase' ),
						'categories' => array( 'header' ),
						'blockTypes' => array( 'core/template-part/header' ),
						'content'    => file_get_contents (get_theme_file_path( '/parts/header-' . $header_pattern . '.html' )),
					)
				);
			}
		}
	}
endif;

add_action( 'init', 'blockbase_register_block_patterns', 9 );