返回介绍

get_column_headers()

发布于 2017-09-10 23:01:29 字数 2438 浏览 955 评论 0 收藏 0

get_column_headers( string|WP_Screen $screen )

Get the column headers for a screen


description


参数

$screen

(string|WP_Screen) (Required) The screen you want the headers for


返回值

(array) Containing the headers in the format id => UI String


源代码

File: wp-admin/includes/screen.php

function get_column_headers( $screen ) {
	if ( is_string( $screen ) )
		$screen = convert_to_screen( $screen );

	static $column_headers = array();

	if ( ! isset( $column_headers[ $screen->id ] ) ) {

		/**
		 * Filters the column headers for a list table on a specific screen.
		 *
		 * The dynamic portion of the hook name, `$screen->id`, refers to the
		 * ID of a specific screen. For example, the screen ID for the Posts
		 * list table is edit-post, so the filter for that screen would be
		 * manage_edit-post_columns.
		 *
		 * @since 3.0.0
		 *
		 * @param array $columns An array of column headers. Default empty.
		 */
		$column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() );
	}

	return $column_headers[ $screen->id ];
}

更新日志

Versiondescription
2.7.0Introduced.

相关函数

Uses

  • wp-admin/includes/screen.php: manage_{$screen->id}_columns
  • wp-admin/includes/template.php: convert_to_screen()
  • wp-includes/plugin.php: apply_filters()

Used By

  • wp-admin/includes/class-wp-screen.php: WP_Screen::render_list_table_columns_preferences()
  • wp-admin/includes/class-wp-list-table.php: WP_List_Table::get_primary_column_name()
  • wp-admin/includes/class-wp-screen.php: WP_Screen::show_screen_options()
  • wp-admin/includes/class-wp-list-table.php: WP_List_Table::get_column_info()
  • wp-admin/includes/class-wp-list-table-compat.php: _WP_List_Table_Compat::get_column_info()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文