function genesis_block_widgets_optin_notification() { $current_screen = get_current_screen(); // Only show on the widgets screen. if ( 'widgets' !== $current_screen->id ) { return; } // Only the show the notice to an administrator. if ( ! current_user_can( 'administrator' ) ) { return; } // If this notice has been dismissed already, don't show it. if ( get_option( 'genesis_notice_dismissed_use_widgets_block_editor' ) ) { return; } // Get the WordPress version. require ABSPATH . WPINC . '/version.php'; // $wp_version; // If the WordPress version is older than 5.8, show no admin notice. if ( version_compare( $wp_version, '5.8-RC1-51325', '<' ) ) { return false; } ?> <div class="notice notice-success"> <p> <?php echo wp_kses_post( sprintf( // Translators: The link html around the help and dismiss links for the widget block editor opt-in. __( 'Note from Genesis: To maintain the best site editing experience for you, we\'ve disabled the widget screen introduced in WordPress 5.8. To learn more about the 5.8 widget experience and how to activate it, click the following link: %1$sLearn more%2$s %3$sDismiss%4$s', 'genesis' ), '<p><a href="https://my.studiopress.com/documentation/snippets/block-editor/enable-block-based-widget-editor" target="_blank" rel="noopener noreferrer" class="button">', '</a>', '<a href="' . wp_nonce_url( add_query_arg( [ 'genesis_widget_block_editor_dismiss' => 1 ], admin_url( 'widgets.php' ) ), 'genesis-widget-block-editor-dismiss' ) . '" rel="noopener noreferrer" class="button">', '</a></p>' ) ); ?> </p> </div> <?php }