wp_print_admin_notice_templates()WP 4.6.0

Prints the JavaScript templates for update admin notices.

Template takes one argument with four values:

param {object} data {
	Arguments for admin notice.

@type string id ID of the notice. @type string className Class names for the notice. @type string message The notice's message. @type string type The type of update the notice is for. Either 'plugin' or 'theme'.

}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wp_print_admin_notice_templates();

Список изменений

С версии 4.6.0 Введена.

Код wp_print_admin_notice_templates() WP 6.7.1

<?php
function wp_print_admin_notice_templates() {
	?>
	<script id="tmpl-wp-updates-admin-notice" type="text/html">
		<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
	</script>
	<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
		<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errorMessage ) { #>notice-error<# } else { #>notice-success<# } #>">
			<p>
				<# if ( data.successMessage ) { #>
					{{{ data.successMessage }}}
				<# } #>
				<# if ( data.errorMessage ) { #>
					<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
						{{{ data.errorMessage }}}
						<span class="screen-reader-text">
							<?php
							/* translators: Hidden accessibility text. */
							_e( 'Show more details' );
							?>
						</span>
						<span class="toggle-indicator" aria-hidden="true"></span>
					</button>
				<# } #>
			</p>
			<# if ( data.errorMessages ) { #>
				<ul class="bulk-action-errors hidden">
					<# _.each( data.errorMessages, function( errorMessage ) { #>
						<li>{{ errorMessage }}</li>
					<# } ); #>
				</ul>
			<# } #>
		</div>
	</script>
	<?php
}