generate_do_wp_block_margin_bottom
-
I’m using GeneratePress together with Kadence Blocks, which generally works fine. I’m having an issue with default bottom margins, however, where the default GP margin trumps Kadence, even when setting specific margins for a Kadence block in the admin.
Looking online, this seems to be due to the generate_do_wp_block_margin_bottom function and the fact that it targets WP core blocks:
if ( apply_filters( 'generate_do_wp_block_margin_bottom', true ) ) {
$css->set_selector( '.entry-content > [class*="wp-block-"]:not(:last-child):not(.wp-block-heading)' );
$css->add_property( 'margin-bottom', floatval( $settings['paragraph_margin'] ), false, 'em' );
}Kadence uses the wp-block- prefix too and so gets targeted.
Reading here https://generatepress.com/forums/topic/style-conflict-with-toolset/, it seems like it should be possible to disable this filter by adding:
add_filter( 'generate_do_wp_block_margin_bottom', '__return_false' );
but this is not working for me. If I could disable this filter, it seems like default GP styling would revert to:
.entry-content [class*="wp-block-"]:not(:last-child)
and this gets overwritten by inline Kadence styling.
- The topic ‘generate_do_wp_block_margin_bottom’ is closed to new replies.