Hi @danstramer,
That snippet is actually (almost exactly) based on GenerateBlock’s (GB’s) code (as mentioned in the Popup Maker doc and my snippet source code.
I didn’t see any other version in the GB docs that takes in a post ID arg. That means you’ll need to call that filter individually for each popup ID.
Here’s an example.
function my_generateblocks_do_content_63 ( $content ) {
$post_id = 63; // Change to your Popup Maker popup ID https://docs.wppopupmaker.com/article/409-find-the-popup-id
if ( has_blocks( $post_id ) ) {
$block_element = get_post( $post_id );
// Where 'popup' is the custom post type for Popup Maker popups.
// The original text from the GenerateBlocks doc is 'your_post_type'
// https://docs.generateblocks.com/article/adding-content-sources-for-dynamic-css-generation/
if ( ! $block_element || 'popup' !== $block_element->post_type ) {
return $content;
}
if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) {
return $content;
}
$content .= $block_element->post_content;
}
return $content;
}
add_filter( 'generateblocks_do_content', 'my_generateblocks_do_content_63', 10 );
function my_generateblocks_do_content_85 ( $content ) {
$post_id = 85; // Change to your Popup Maker popup ID https://docs.wppopupmaker.com/article/409-find-the-popup-id
if ( has_blocks( $post_id ) ) {
$block_element = get_post( $post_id );
// Where 'popup' is the custom post type for Popup Maker popups.
// The original text from the GenerateBlocks doc is 'your_post_type'
// https://docs.generateblocks.com/article/adding-content-sources-for-dynamic-css-generation/
if ( ! $block_element || 'popup' !== $block_element->post_type ) {
return $content;
}
if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) {
return $content;
}
$content .= $block_element->post_content;
}
return $content;
}
add_filter( 'generateblocks_do_content', 'my_generateblocks_do_content_85', 10 );
Yes. It’s clunky.
I’ll ask the GB team if they can get us a version of their filter that also takes a post ID arg if they don’t have one yet. I can post a link to that thread here in a bit.