correct

gutentberg/block-library/blocks/query-loop.php line:73

$content = '<div class="article-wrapper">';//追加
foreach ( $posts as $post ) {
     $content .= '<article id="post-'.$post->ID.'">';// 追加 todo post_class
     $content .= (
         new WP_Block(
             $block->parsed_block,
             array(
                 'postType' => $post->post_type,
                 'postId'   => $post->ID,
             )
         )
     )->render( array( 'dynamic' => false ) );
     $content .= '</article>';//追加
}
$content .= '</div>';//追加
 return $content;

query-pagination.php

function gutenberg_render_block_core_query_pagination( $attributes, $content, $block ) {
 $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
 $page     = empty( $_GET[ $page_key ] ) ? 1 : filter_var( $_GET[ $page_key ], FILTER_VALIDATE_INT );
 $content = '<nav class="pagination">';//追加
 if ( 1 !== $page ) {
     $content .= sprintf(
         '<div><a href="%s">%s</a></div>',
         esc_url( add_query_arg( $page_key, '2' === $page ? false : $page - 1 ) ),
         __( 'Previous', 'gutenberg' )     );
 }
 if ( $page < ( isset( $block->context['query']['pages'] ) ? $block->context['query']['pages'] : 1 ) ) {
     $content .= sprintf(
         '<div><a href="%s">%s</a></div>',
         esc_url( add_query_arg( $page_key, $page + 1 ) ),
         __( 'Next', 'gutenberg' )     ); 
 }
 $content .= '</nav>';//追加
 return $content;
 }

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

[emulsion_relate_posts]