wp/wp-includes/blocks/categories.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    49 
    49 
    50 	if ( isset( $attributes['className'] ) ) {
    50 	if ( isset( $attributes['className'] ) ) {
    51 		$class .= " {$attributes['className']}";
    51 		$class .= " {$attributes['className']}";
    52 	}
    52 	}
    53 
    53 
    54 	$block_content = sprintf(
    54 	return sprintf(
    55 		$wrapper_markup,
    55 		$wrapper_markup,
    56 		esc_attr( $class ),
    56 		esc_attr( $class ),
    57 		$items_markup
    57 		$items_markup
    58 	);
    58 	);
    59 
       
    60 	return $block_content;
       
    61 }
    59 }
    62 
    60 
    63 /**
    61 /**
    64  * Generates the inline script for a categories dropdown field.
    62  * Generates the inline script for a categories dropdown field.
    65  *
    63  *
    89 
    87 
    90 /**
    88 /**
    91  * Registers the `core/categories` block on server.
    89  * Registers the `core/categories` block on server.
    92  */
    90  */
    93 function register_block_core_categories() {
    91 function register_block_core_categories() {
    94 	register_block_type(
    92 	register_block_type_from_metadata(
    95 		'core/categories',
    93 		__DIR__ . '/categories',
    96 		array(
    94 		array(
    97 			'render_callback' => 'render_block_core_categories',
    95 			'render_callback' => 'render_block_core_categories',
    98 		)
    96 		)
    99 	);
    97 	);
   100 }
    98 }
   101 
       
   102 add_action( 'init', 'register_block_core_categories' );
    99 add_action( 'init', 'register_block_core_categories' );