Changeset 56710 for trunk/src/wp-includes/blocks/query-pagination-next.php
- Timestamp:
- 09/26/2023 02:20:18 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/query-pagination-next.php
r56065 r56710 16 16 */ 17 17 function render_block_core_query_pagination_next( $attributes, $content, $block ) { 18 $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page'; 19 $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; 20 $max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0; 18 $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page'; 19 $enhanced_pagination = isset( $block->context['enhancedPagination'] ) && $block->context['enhancedPagination']; 20 $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; 21 $max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0; 21 22 22 23 $wrapper_attributes = get_block_wrapper_attributes(); … … 37 38 // Check if the pagination is for Query that inherits the global context. 38 39 if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) { 39 $filter_link_attributes = static function () use ( $wrapper_attributes ) {40 $filter_link_attributes = static function () use ( $wrapper_attributes ) { 40 41 return $wrapper_attributes; 41 42 }; … … 62 63 wp_reset_postdata(); // Restore original Post Data. 63 64 } 65 66 if ( $enhanced_pagination ) { 67 $p = new WP_HTML_Tag_Processor( $content ); 68 if ( $p->next_tag( 69 array( 70 'tag_name' => 'a', 71 'class_name' => 'wp-block-query-pagination-next', 72 ) 73 ) ) { 74 $p->set_attribute( 'data-wp-key', 'query-pagination-next' ); 75 $p->set_attribute( 'data-wp-on--click', 'actions.core.query.navigate' ); 76 $p->set_attribute( 'data-wp-on--mouseenter', 'actions.core.query.prefetch' ); 77 $p->set_attribute( 'data-wp-effect', 'effects.core.query.prefetch' ); 78 $content = $p->get_updated_html(); 79 } 80 } 81 64 82 return $content; 65 83 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)