generateblocks_do_content in loop
-
Hi, thank you for this plugin.
I’m pulling in content using WP_Query and a “while ( have_posts() ) : the_post()” loop, using the_content() to output the post.
How can I ensure the generateblocks_do_content filter is being called for each post in the loop so that the CSS for each post can be generated?
So something like this, which isn’t working because the filter is not called within the loop:
add_filter( 'generateblocks_do_content', function( $content ) { $post_id = get_the_ID(); // A post ID to check the content of. Can be dynamically set. if ( $post_id && has_blocks( $post_id ) ) { $block_element = get_post( $post_id ); if ( ! $block_element ) { return $content; } if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) { return $content; } $content .= $block_element->post_content; } return $content; } );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘generateblocks_do_content in loop’ is closed to new replies.