equal
deleted
inserted
replaced
4 * |
4 * |
5 * @package WordPress |
5 * @package WordPress |
6 */ |
6 */ |
7 |
7 |
8 /** |
8 /** |
|
9 * Renders the `core/query-pagination` block on the server. |
|
10 * |
|
11 * @param array $attributes Block attributes. |
|
12 * @param string $content Block default content. |
|
13 * |
|
14 * @return string Returns the wrapper for the Query pagination. |
|
15 */ |
|
16 function render_block_core_query_pagination( $attributes, $content ) { |
|
17 if ( empty( trim( $content ) ) ) { |
|
18 return ''; |
|
19 } |
|
20 |
|
21 $wrapper_attributes = get_block_wrapper_attributes( |
|
22 array( |
|
23 'role' => 'navigation', |
|
24 'aria-label' => __( 'Pagination' ), |
|
25 ) |
|
26 ); |
|
27 |
|
28 return sprintf( |
|
29 '<nav %1$s>%2$s</nav>', |
|
30 $wrapper_attributes, |
|
31 $content |
|
32 ); |
|
33 } |
|
34 |
|
35 /** |
9 * Registers the `core/query-pagination` block on the server. |
36 * Registers the `core/query-pagination` block on the server. |
10 */ |
37 */ |
11 function register_block_core_query_pagination() { |
38 function register_block_core_query_pagination() { |
12 register_block_type_from_metadata( |
39 register_block_type_from_metadata( |
13 __DIR__ . '/query-pagination' |
40 __DIR__ . '/query-pagination', |
|
41 array( |
|
42 'render_callback' => 'render_block_core_query_pagination', |
|
43 ) |
14 ); |
44 ); |
15 } |
45 } |
16 add_action( 'init', 'register_block_core_query_pagination' ); |
46 add_action( 'init', 'register_block_core_query_pagination' ); |