Archived topic
Advanced Popups
9 replies · Started by Rob on June 30, 2022
Hi there,
Im using Advanced Popups. Which allows me to add GenerateBlocks into the post.
However, when I then test the form, it pops up, it has the content, it even has gb- classes in the markup. But its not respecting the grid/container settings from GenerateBlocks.
Is there a way to get this working correctly?
Rob.
Hi there,
What if you got to Settings > GenerateBlocks and set the CSS generation to: Inline ?
Hi David,
Still the same im afraid. Cache Dynamic CSS is also off.
Thanks
Rob.
Is it possible to ask the Pop up plugin author how the pop up is generated ? Presumably its a CPT,
Hi David,
Now this just might be a fluke but Ive got it working I think! Using 2 functions I found on the internet, and snooping in the plugins php I found the name of the CPT being registered.
add_filter( 'generateblocks_do_content', function( $content ) {
$args = array(
'post_type' => 'adp-popup',
// Other args if you need them.
);
$posts = get_posts( $args );
foreach ( (array) $posts as $post ) {
if ( isset( $post->post_content ) ) {
$content .= $post->post_content;
}
}
return $content;
} );
And also
add_filter( 'generate_blog_columns', function( $columns ) {
if ( 'adp-popup' === get_post_type() && ! is_singular() ) {
return true;
}
return $columns;
} );
Might be worth you guy adding this to your internal KB, if it helps.
Rob.
In fact it seems to work fine without the 2nd snippet actually.
Awesome - thanks for sharing your final code.
Yeah, you don't need to use the second code as thats to enable the GP Blog Columns
Out of interest which plugin did you use for the Popup ?
Its handy to pair the CPT name with the plugin in case other users have the issue :)
For others see reference example to filter:
https://docs.generateblocks.com/article/adding-content-sources-for-dynamic-css-generation/
Its in the GB Docs.
Thanks Rob - much appreciated!