$val ) { if( strpos( $key, 'bp-' ) === 0 ) { $name = ltrim( $key, 'bp-' ); $pattern_array[$name] = strlen( $name ) . '-' . md5( $name ) . '.txt'; } } unset( $mods ); $i = 0; foreach( (array)$pattern_array as $key => $val ) { if( file_exists( $pattern_path . $val ) === true ) { $pattern = $wp_filesystem->get_contents( $pattern_path . $val ); register_block_pattern( 'luxe-blocks/block-pattern-' . $i, //ブロックパターン名 array( 'title' => htmlspecialchars_decode( $key ), //ブロックパターンのタイトル 'content' => $pattern, //ブロックの HTML コンテンツ 'categories' => array( 'luxeritas-block-patterns' ), //ブロックパターンのカテゴリ ) ); } ++$i; } });