diff --git a/modal-theme-part/gutenberg-modal.php b/modal-theme-part/gutenberg-modal.php new file mode 100644 index 0000000..8f16e41 --- /dev/null +++ b/modal-theme-part/gutenberg-modal.php @@ -0,0 +1,29 @@ +post_type !== 'page' ) { + // Prevent the modal block from being added in any post or template + $allowed_blocks = array_diff( $allowed_blocks, ['your-theme/modal'] ); + } + + return $allowed_blocks; +} +add_filter( 'allowed_block_types', 'restrict_modal_block_in_templates', 10, 2 ); + +/* Add the modal to the footer (or optionally use wp_head to add it to the header) */ + +function add_modal_to_every_page() { + // Get the modal content from the theme part or reusable block + $modal_content = get_theme_part( 'modal' ); // Assuming get_theme_part is a custom function to fetch your modal content. + + if ( $modal_content ) { + echo '