Plugin Author
Tom
(@edge22)
Hi there,
Yes, you will need to ask Astra how you can implement the following method with their hooks: https://docs.generateblocks.com/article/adding-content-sources-for-dynamic-css-generation/
They should be able to help quite easily 🙂
Thanks!
Thread Starter
jlop77
(@jlop77)
Excellent.
I’m not an expert and I could do it very easily.
My favorite topics are Astra and Generatepress, use them with all my clients. Waiting with longing the new version of Generatepress Premium.
Thanks.
Thread Starter
jlop77
(@jlop77)
One last question, how do I do to group several $ post_id? I would like to use this method with several Hook that I want to implement.
I did the test separating them with commas and it did not work:
add_filter( ‘generateblocks_do_content’, function( $content ) {
$post_id = 1549, 1552;
Sorry, I imagine it’s easy, but I do not have knowledge 🙁
Plugin Author
Tom
(@edge22)
Ideally you would be able to dynamically get all post IDs that are “hooks” instead of manually defining them.
Then you could do this:
add_filter( 'generateblocks_do_content', function( $content ) {
$post_ids = array( 123, 456, 789 );
foreach ( $post_ids as $post_id ) {
if ( has_blocks( $post_id ) ) {
$block_element = get_post( $post_id );
if ( ! $block_element || 'your_post_type' !== $block_element->post_type ) {
continue;
}
if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) {
continue;
}
$content .= $block_element->post_content;
}
}
return $content;
} );
Be sure to adjust your_post_type
to the slug of the correct post type.