函数文档

wp_print_update_row_templates()

💡 云策文档标注

概述

wp_print_update_row_templates() 函数用于在列表表格中输出更新和删除行的 JavaScript 模板,通常用于 WordPress 后台管理界面。

关键要点

  • 函数功能:打印列表表格中更新和删除行的 JavaScript 模板
  • 引入版本:WordPress 4.6.0 中首次引入
  • 相关函数:与 Description_x() 等本地化函数相关,位于 wp-includes/l10n.php

📄 原文内容

Prints the JavaScript templates for update and deletion rows in list tables.

Source

function wp_print_update_row_templates() {
?>
<script id="tmpl-item-update-row" type="text/template">
<tr class="plugin-update-tr update" id="
{{ data.slug }}-update" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="
{{ data.colspan }}" class="plugin-update colspanchange">
{{{ data.content }}}
</td>
</tr>
</script>
<script id="tmpl-item-deleted-row" type="text/template">
<tr class="plugin-deleted-tr inactive deleted" id="
{{ data.slug }}-deleted" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="
{{ data.colspan }}" class="plugin-update colspanchange">
<# if ( data.plugin ) { #>
<?php
printf(
/* translators: %s: Plugin name. */
_x( '%s was successfully deleted.', 'plugin' ),
'<strong>
{{{ data.name }}}</strong>'
);
?>

<# } else { #>
<?php
printf(
/* translators: %s: Theme name. */
_x( '%s was successfully deleted.', 'theme' ),
'<strong>
{{{ data.name }}}</strong>'
);
?>

<# } #>
</td>
</tr>
</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#L979">View on Trac</a> <a href="https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/update.php#L979-L1012">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/_x/">_x()</a><code>wp-includes/l10n.php

Retrieves translated string with gettext context.

Changelog

Version Description
4.6.0 Introduced.