函数文档

wp_print_admin_notice_templates()

💡 云策文档标注

概述

wp_print_admin_notice_templates() 函数用于输出更新管理通知的 JavaScript 模板,通常用于 WordPress 后台界面。

关键要点

  • 函数功能:打印更新管理通知的 JavaScript 模板
  • 引入版本:WordPress 4.6.0
  • 相关函数:与 install_plugin_information() 等函数关联使用

📄 原文内容

Prints the JavaScript templates for update admin notices.

Source

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>
</pre><p class="wporg-dot-link-list"><a href="https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/">View all references</a> <a href="https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/update.php#L916">View on Trac</a> <a href="https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/update.php#L916-L950">View on GitHub</a></p></section>

<section class="wp-block-wporg-code-reference-related" data-nosnippet="true"><h2 id="related" class="is-toc-heading wp-block-heading has-heading-5-font-size" tabindex="-1" ><a href="#related">Related</a></h2> <section style="margin-top:var(--wp--preset--spacing--20)" class="wp-block-wporg-code-table" id="uses"><figure class="wp-block-table "><table><thead><tr><th scope="col">Uses</th><th scope="col">Description</th></tr></thead><tbody><tr class=""><td><a href="https://developer.wordpress.org/reference/functions/_e/">_e()</a><code>wp-includes/l10n.php

Displays translated text.

Used by Description
install_plugin_information()wp-admin/includes/plugin-install.php

Displays plugin information in dialog box form.

Changelog

Version Description
4.6.0 Introduced.