WP_Compat::using_block_function_theme()

Action hooked to admin_notices to display an admin notice on themes page.


Return

(void)


Source

File: wp-includes/classicpress/class-wp-compat.php

	public function using_block_function_theme() {
		global $pagenow;
		if ( 'themes.php' !== $pagenow ) {
			return;
		}

		$theme_using_blocks = get_option( 'theme_using_blocks', '0' );
		if ( ! in_array( $theme_using_blocks, array( '1', '2' ), true ) ) {
			return;
		}

		if ( '1' === $theme_using_blocks ) {
			// Translators: %1$s is the theme name.
			$message  = sprintf( esc_html__( '%1$s uses block-related functions and may have issues.' ), wp_get_theme()->get( 'Name' ) );
			$message .= ' <a href="https://docs.classicpress.net/user-guides/using-classicpress/settings-general-screen/#blocks-compatibility">' . __( 'Learn more' ) . '</a> |';
			$message .= ' <a href="https://forums.classicpress.net/new-topic?category=themes/theme-support&tags=blocks-compatibility&title=' . urlencode( wp_get_theme()->get( 'Name' ) ) . '+blocks+compatibility">' . __( 'Report an issue &rsaquo;' ) . '</a>';
		} else {
			// Translators: %1$s is the theme name, %1$s is the parent theme name.
			$message = sprintf( esc_html__( '%1$s parent theme (%2$s) uses block-related functions and may have issues.' ), wp_get_theme()->get( 'Name' ), wp_get_theme()->parent()->get( 'Name' ) );
			$message .= ' <a href="https://docs.classicpress.net/user-guides/using-classicpress/settings-general-screen/#blocks-compatibility">' . __( 'Learn more' ) . '</a> |';
			$message .= ' <a href="https://forums.classicpress.net/new-topic?category=themes/theme-support&tags=blocks-compatibility&title=' . urlencode( wp_get_theme()->parent()->get( 'Name' ) ) . '+blocks+compatibility">' . __( 'Report an issue &rsaquo;' ) . '</a>';
		}

		?>
		<div class="notice notice-warning">
			<p>
			<?php
				echo $message;
			?>
		</div>
		<?php
	}