Skip to content

Commit

Permalink
Cater for changes in Gutenberg 12.3.0 #13
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed May 3, 2022
1 parent 18da552 commit ebec1e2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion includes/post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,25 @@ function sb_render_block_core_post_template_main_query( $attributes, $content, $
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );

$content = '';
foreach ( $wp_query->posts as $index => $post ) {
$saved_post = $GLOBALS['post'];
//in_the_loop();
//global $wp_query;
//set_query_var( 'in_the_loop', ;
//$wp_query->in_the_loop = true;
//global $wp_actions;

//foreach ( $wp_query->posts as $index => $post ) {
$index = 0;
while ( $wp_query->have_posts() ) {
$wp_query->the_post();



//$GLOBALS['post'] = $post;
//$wp_actions['the_post'] = 0;
if ( $index >= $attributes['offset'] && $index < $attributes['limit']) {
//$content = get_the_content( null, false, $post );
$post = get_post();
$block_content = (
new WP_Block(
$block->parsed_block,
Expand All @@ -92,7 +109,11 @@ function sb_render_block_core_post_template_main_query( $attributes, $content, $
)->render(array('dynamic' => false));
$content .= "<li>{$block_content}</li>";
}
$index++;
}
$GLOBALS['post'] = $saved_post;
//$wp_query->in_the_loop = true;
//set_query_var( 'in_the_loop', true );

return sprintf(
'<ul %1$s>%2$s</ul>',
Expand Down

0 comments on commit ebec1e2

Please sign in to comment.