Make set_current_screen() taxonomy aware. Use current_screen when setting up table headers for edit-tags.php. see #13783
git-svn-id: http://svn.automattic.com/wordpress/trunk@15175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d68747d9af
commit
1849b362b0
|
@ -81,10 +81,15 @@ if ( isset($_GET['page']) ) {
|
|||
}
|
||||
|
||||
if ( isset($_GET['post_type']) )
|
||||
$typenow = sanitize_user($_GET['post_type'], true);
|
||||
$typenow = sanitize_key($_GET['post_type']);
|
||||
else
|
||||
$typenow = '';
|
||||
|
||||
if ( isset($_GET['taxonomy']) )
|
||||
$taxnow = sanitize_key($_GET['taxonomy']);
|
||||
else
|
||||
$taxnow = '';
|
||||
|
||||
require(ABSPATH . 'wp-admin/menu.php');
|
||||
|
||||
if ( current_user_can( 'manage_options' ) )
|
||||
|
|
|
@ -296,17 +296,16 @@ if ( $page_links )
|
|||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
<?php $table_type = ('category' == $taxonomy ? 'categories' : 'edit-tags'); ?>
|
||||
<table class="widefat tag fixed" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php print_column_headers($table_type); ?>
|
||||
<?php print_column_headers($current_screen); ?>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<?php print_column_headers($table_type, false); ?>
|
||||
<?php print_column_headers($current_screen, false); ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ function wp_link_category_checklist( $link_id = 0 ) {
|
|||
* @return unknown
|
||||
*/
|
||||
function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
|
||||
global $post_type;
|
||||
global $post_type, $current_screen;
|
||||
static $row_class = '';
|
||||
$row_class = ($row_class == '' ? ' class="alternate"' : '');
|
||||
|
||||
|
@ -422,8 +422,8 @@ function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
|
|||
$out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';
|
||||
|
||||
|
||||
$columns = get_column_headers('edit-tags');
|
||||
$hidden = get_hidden_columns('edit-tags');
|
||||
$columns = get_column_headers($current_screen);
|
||||
$hidden = get_hidden_columns($current_screen);
|
||||
$default_term = get_option('default_' . $taxonomy);
|
||||
foreach ( $columns as $column_name => $column_display_name ) {
|
||||
$class = "class=\"$column_name column-$column_name\"";
|
||||
|
@ -3900,7 +3900,7 @@ function compression_test() {
|
|||
* @param string $id Screen id, optional.
|
||||
*/
|
||||
function set_current_screen( $id = '' ) {
|
||||
global $current_screen, $hook_suffix, $typenow;
|
||||
global $current_screen, $hook_suffix, $typenow, $taxnow;
|
||||
|
||||
if ( empty($id) ) {
|
||||
$current_screen = $hook_suffix;
|
||||
|
@ -3932,6 +3932,11 @@ function set_current_screen( $id = '' ) {
|
|||
$typenow = 'post';
|
||||
$current_screen->id = $typenow;
|
||||
$current_screen->post_type = $typenow;
|
||||
} elseif ( 'edit-tags' == $current_screen->id ) {
|
||||
if ( empty($taxnow) )
|
||||
$taxnow = 'post_tag';
|
||||
$current_screen->id = 'edit-' . $taxnow;
|
||||
$current_screen->taxonomy = $taxnow;
|
||||
}
|
||||
|
||||
$current_screen = apply_filters('current_screen', $current_screen);
|
||||
|
|
Loading…
Reference in New Issue