3 * Posts List Table class.
6 * @subpackage List_Table
10 class WP_Posts_List_Table extends WP_List_Table {
13 * Whether the items should be displayed hierarchically or linearly
19 var $hierarchical_display;
22 * Holds the number of pending comments for each post
28 var $comment_pending_count;
31 * Holds the number of posts for this user
37 var $user_posts_count;
40 * Holds the number of posts which are sticky.
46 var $sticky_posts_count = 0;
48 function WP_Posts_List_Table() {
49 global $post_type_object, $post_type, $wpdb;
51 if ( !isset( $_REQUEST['post_type'] ) )
53 elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) )
54 $post_type = $_REQUEST['post_type'];
56 wp_die( __( 'Invalid post type' ) );
57 $_REQUEST['post_type'] = $post_type;
59 $post_type_object = get_post_type_object( $post_type );
61 if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
62 $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
63 SELECT COUNT( 1 ) FROM $wpdb->posts
64 WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
66 ", $post_type, get_current_user_id() ) );
68 if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
69 $_GET['author'] = get_current_user_id();
72 if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
73 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
74 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
77 parent::WP_List_Table( array(
82 function ajax_user_can() {
83 global $post_type_object;
85 return current_user_can( $post_type_object->cap->edit_posts );
88 function prepare_items() {
89 global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode;
91 $avail_post_stati = wp_edit_posts_query();
93 $this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] );
95 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
97 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
98 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
100 if ( $this->hierarchical_display )
101 $total_pages = ceil( $total_items / $per_page );
103 $total_pages = $wp_query->max_num_pages;
105 $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
107 $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash';
109 $this->set_pagination_args( array(
110 'total_items' => $total_items,
111 'total_pages' => $total_pages,
112 'per_page' => $per_page
116 function has_items() {
120 function no_items() {
121 global $post_type_object;
123 if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
124 echo $post_type_object->labels->not_found_in_trash;
126 echo $post_type_object->labels->not_found;
129 function get_views() {
130 global $post_type, $post_type_object, $locked_post_status, $avail_post_stati;
132 if ( !empty($locked_post_status) )
135 $status_links = array();
136 $num_posts = wp_count_posts( $post_type, 'readable' );
140 $current_user_id = get_current_user_id();
142 if ( $this->user_posts_count ) {
143 if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) )
144 $class = ' class="current"';
145 $status_links['mine'] = "<a href='edit.php?post_type=$post_type&author=$current_user_id'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ) . '</a>';
146 $allposts = '&all_posts=1';
149 $total_posts = array_sum( (array) $num_posts );
151 // Subtract post types that are not included in the admin all list.
152 foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
153 $total_posts -= $num_posts->$state;
155 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
156 $status_links['all'] = "<a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
158 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
161 $status_name = $status->name;
163 if ( !in_array( $status_name, $avail_post_stati ) )
166 if ( empty( $num_posts->$status_name ) )
169 if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
170 $class = ' class="current"';
172 $status_links[$status_name] = "<a href='edit.php?post_status=$status_name&post_type=$post_type'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
175 if ( ! empty( $this->sticky_posts_count ) ) {
176 $class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
178 $sticky_link = array( 'sticky' => "<a href='edit.php?post_type=$post_type&show_sticky=1'$class>" . sprintf( _nx( 'Sticky <span class="count">(%s)</span>', 'Sticky <span class="count">(%s)</span>', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . '</a>' );
180 // Sticky comes after Publish, or if not listed, after All.
181 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
182 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
185 return $status_links;
188 function get_bulk_actions() {
191 if ( $this->is_trash )
192 $actions['untrash'] = __( 'Restore' );
194 $actions['edit'] = __( 'Edit' );
196 if ( $this->is_trash || !EMPTY_TRASH_DAYS )
197 $actions['delete'] = __( 'Delete Permanently' );
199 $actions['trash'] = __( 'Move to Trash' );
204 function extra_tablenav( $which ) {
205 global $post_type, $post_type_object, $cat;
207 <div class="alignleft actions">
209 if ( 'top' == $which && !is_singular() ) {
211 $this->months_dropdown( $post_type );
213 if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
214 $dropdown_options = array(
215 'show_option_all' => __( 'View all categories' ),
222 wp_dropdown_categories( $dropdown_options );
224 do_action( 'restrict_manage_posts' );
225 submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
228 if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
229 submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false );
236 function current_action() {
237 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
240 return parent::current_action();
243 function pagination( $which ) {
244 global $post_type_object, $mode;
246 parent::pagination( $which );
248 if ( 'top' == $which && !$post_type_object->hierarchical )
249 $this->view_switcher( $mode );
252 function get_table_classes() {
253 global $post_type_object;
255 return array( 'widefat', 'fixed', $post_type_object->hierarchical ? 'pages' : 'posts' );
258 function get_columns() {
259 $screen = get_current_screen();
261 if ( empty( $screen ) )
264 $post_type = $screen->post_type;
266 $posts_columns = array();
268 $posts_columns['cb'] = '<input type="checkbox" />';
270 /* translators: manage posts column name */
271 $posts_columns['title'] = _x( 'Title', 'column name' );
273 if ( post_type_supports( $post_type, 'author' ) )
274 $posts_columns['author'] = __( 'Author' );
276 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) )
277 $posts_columns['categories'] = __( 'Categories' );
279 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) )
280 $posts_columns['tags'] = __( 'Tags' );
282 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
283 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) )
284 $posts_columns['comments'] = '<div class="vers"><img alt="' . esc_attr__( 'Comments' ) . '" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
286 $posts_columns['date'] = __( 'Date' );
288 if ( 'page' == $post_type )
289 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
291 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
292 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
294 return $posts_columns;
297 function get_sortable_columns() {
300 'author' => 'author',
301 'parent' => 'parent',
302 'comments' => 'comment_count',
303 'date' => array( 'date', true )
307 function display_rows( $posts = array() ) {
308 global $wp_query, $post_type_object, $per_page;
310 if ( empty( $posts ) )
311 $posts = $wp_query->posts;
313 if ( $this->hierarchical_display ) {
314 $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
316 $this->_display_rows( $posts );
320 function _display_rows( $posts ) {
323 add_filter( 'the_title', 'esc_html' );
325 // Create array of post IDs.
328 foreach ( $posts as $a_post )
329 $post_ids[] = $a_post->ID;
331 $this->comment_pending_count = get_pending_comments_num( $post_ids );
333 foreach ( $posts as $post )
334 $this->single_row( $post );
337 function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
343 $pages = get_pages( array( 'sort_column' => 'menu_order' ) );
350 * arrange pages into two parts: top level pages and children_pages
351 * children_pages is two dimensional array, eg.
352 * children_pages[10][] contains all sub-pages whose parent is 10.
353 * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations
354 * If searching, ignore hierarchy and treat everything as top level
356 if ( empty( $_REQUEST['s'] ) ) {
358 $top_level_pages = array();
359 $children_pages = array();
361 foreach ( $pages as $page ) {
363 // catch and repair bad pages
364 if ( $page->post_parent == $page->ID ) {
365 $page->post_parent = 0;
366 $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
367 clean_page_cache( $page->ID );
370 if ( 0 == $page->post_parent )
371 $top_level_pages[] = $page;
373 $children_pages[ $page->post_parent ][] = $page;
376 $pages = &$top_level_pages;
380 $start = ( $pagenum - 1 ) * $per_page;
381 $end = $start + $per_page;
383 foreach ( $pages as $page ) {
384 if ( $count >= $end )
387 if ( $count >= $start )
388 echo "\t" . $this->single_row( $page, $level );
392 if ( isset( $children_pages ) )
393 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
396 // if it is the last pagenum and there are orphaned pages, display them with paging as well
397 if ( isset( $children_pages ) && $count < $end ){
398 foreach ( $children_pages as $orphans ){
399 foreach ( $orphans as $op ) {
400 if ( $count >= $end )
402 if ( $count >= $start )
403 echo "\t" . $this->single_row( $op, 0 );
411 * Given a top level page ID, display the nested hierarchy of sub-pages
412 * together with paging support
414 * @since 3.1.0 (Standalone function exists since 2.6.0)
416 * @param unknown_type $children_pages
417 * @param unknown_type $count
418 * @param unknown_type $parent
419 * @param unknown_type $level
420 * @param unknown_type $pagenum
421 * @param unknown_type $per_page
423 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
425 if ( ! isset( $children_pages[$parent] ) )
428 $start = ( $pagenum - 1 ) * $per_page;
429 $end = $start + $per_page;
431 foreach ( $children_pages[$parent] as $page ) {
433 if ( $count >= $end )
436 // If the page starts in a subtree, print the parents.
437 if ( $count == $start && $page->post_parent > 0 ) {
438 $my_parents = array();
439 $my_parent = $page->post_parent;
440 while ( $my_parent ) {
441 $my_parent = get_post( $my_parent );
442 $my_parents[] = $my_parent;
443 if ( !$my_parent->post_parent )
445 $my_parent = $my_parent->post_parent;
447 $num_parents = count( $my_parents );
448 while ( $my_parent = array_pop( $my_parents ) ) {
449 echo "\t" . $this->single_row( $my_parent, $level - $num_parents );
454 if ( $count >= $start )
455 echo "\t" . $this->single_row( $page, $level );
459 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
462 unset( $children_pages[$parent] ); //required in order to keep track of orphans
465 function single_row( $a_post, $level = 0 ) {
466 global $post, $current_screen, $mode;
469 $global_post = $post;
471 setup_postdata( $post );
473 $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
474 $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
475 $edit_link = get_edit_post_link( $post->ID );
476 $title = _draft_or_post_title();
477 $post_type_object = get_post_type_object( $post->post_type );
478 $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
479 $post_format = get_post_format( $post->ID );
480 $post_format_class = ( $post_format && !is_wp_error($post_format) ) ? 'format-' . sanitize_html_class( $post_format ) : 'format-default';
482 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status . ' ' . $post_format_class); ?> iedit' valign="top">
485 list( $columns, $hidden ) = $this->get_column_info();
487 foreach ( $columns as $column_name => $column_display_name ) {
488 $class = "class=\"$column_name column-$column_name\"";
491 if ( in_array( $column_name, $hidden ) )
492 $style = ' style="display:none;"';
494 $attributes = "$class$style";
496 switch ( $column_name ) {
500 <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
505 if ( $this->hierarchical_display ) {
506 $attributes = 'class="post-title page-title column-title"' . $style;
508 if ( 0 == $level && (int) $post->post_parent > 0 ) {
509 //sent level 0 by accident, by default, or because we don't know the actual level
510 $find_main_page = (int) $post->post_parent;
511 while ( $find_main_page > 0 ) {
512 $parent = get_page( $find_main_page );
514 if ( is_null( $parent ) )
518 $find_main_page = (int) $parent->post_parent;
520 if ( !isset( $parent_name ) )
521 $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
525 $post->post_title = esc_html( $post->post_title );
526 $pad = str_repeat( '— ', $level );
528 <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
532 $attributes = 'class="post-title page-title column-title"' . $style;
534 <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states( $post ); ?></strong>
536 if ( 'excerpt' == $mode ) {
542 if ( $can_edit_post && 'trash' != $post->post_status ) {
543 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
544 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>';
546 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
547 if ( 'trash' == $post->post_status )
548 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
549 elseif ( EMPTY_TRASH_DAYS )
550 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
551 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
552 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
554 if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
555 if ( $can_edit_post )
556 $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
557 } elseif ( 'trash' != $post->post_status ) {
558 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
561 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
562 echo $this->row_actions( $actions );
564 get_inline_data( $post );
569 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
570 $t_time = $h_time = __( 'Unpublished' );
573 $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
574 $m_time = $post->post_date;
575 $time = get_post_time( 'G', true, $post );
577 $time_diff = time() - $time;
579 if ( $time_diff > 0 && $time_diff < 24*60*60 )
580 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
582 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
585 echo '<td ' . $attributes . '>';
586 if ( 'excerpt' == $mode )
587 echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
589 echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
591 if ( 'publish' == $post->post_status ) {
593 } elseif ( 'future' == $post->post_status ) {
594 if ( $time_diff > 0 )
595 echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
599 _e( 'Last Modified' );
606 <td <?php echo $attributes ?>><?php
607 $categories = get_the_category();
608 if ( !empty( $categories ) ) {
610 foreach ( $categories as $c ) {
611 $out[] = sprintf( '<a href="%s">%s</a>',
612 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ),
613 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) )
616 echo join( ', ', $out );
618 _e( 'Uncategorized' );
626 <td <?php echo $attributes ?>><?php
627 $tags = get_the_tags( $post->ID );
628 if ( !empty( $tags ) ) {
630 foreach ( $tags as $c ) {
631 $out[] = sprintf( '<a href="%s">%s</a>',
632 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ),
633 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) )
636 echo join( ', ', $out );
646 <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
648 $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
650 $this->comments_bubble( $post->ID, $pending_comments );
658 <td <?php echo $attributes ?>><?php
659 printf( '<a href="%s">%s</a>',
660 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
669 <td <?php echo $attributes ?>><?php
670 if ( is_post_type_hierarchical( $post->post_type ) )
671 do_action( 'manage_pages_custom_column', $column_name, $post->ID );
673 do_action( 'manage_posts_custom_column', $column_name, $post->ID );
674 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
683 $post = $global_post;
687 * Outputs the hidden row displayed when inline editing
691 function inline_edit() {
694 $screen = get_current_screen();
696 $post = get_default_post_to_edit( $screen->post_type );
697 $post_type_object = get_post_type_object( $screen->post_type );
699 $taxonomy_names = get_object_taxonomies( $screen->post_type );
700 $hierarchical_taxonomies = array();
701 $flat_taxonomies = array();
702 foreach ( $taxonomy_names as $taxonomy_name ) {
703 $taxonomy = get_taxonomy( $taxonomy_name );
705 if ( !$taxonomy->show_ui )
708 if ( $taxonomy->hierarchical )
709 $hierarchical_taxonomies[] = $taxonomy;
711 $flat_taxonomies[] = $taxonomy;
714 $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
715 $can_publish = current_user_can( $post_type_object->cap->publish_posts );
716 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
720 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
722 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
724 while ( $bulk < 2 ) { ?>
726 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
727 echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";
728 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
730 <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
731 <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
734 if ( post_type_supports( $screen->post_type, 'title' ) ) :
736 <div id="bulk-title-div">
737 <div id="bulk-titles"></div>
740 <?php else : // $bulk ?>
743 <span class="title"><?php _e( 'Title' ); ?></span>
744 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
748 <span class="title"><?php _e( 'Slug' ); ?></span>
749 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
752 <?php endif; // $bulk
753 endif; // post_type_supports title ?>
755 <?php if ( !$bulk ) : ?>
756 <label><span class="title"><?php _e( 'Date' ); ?></span></label>
757 <div class="inline-edit-date">
758 <?php touch_time( 1, 1, 4, 1 ); ?>
761 <?php endif; // $bulk
763 if ( post_type_supports( $screen->post_type, 'author' ) ) :
764 $authors_dropdown = '';
766 if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
768 'hide_if_only_one_author' => false,
770 'name' => 'post_author',
776 $users_opt['show_option_none'] = __( '— No Change —' );
778 if ( $authors = wp_dropdown_users( $users_opt ) ) :
779 $authors_dropdown = '<label class="inline-edit-author">';
780 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
781 $authors_dropdown .= $authors;
782 $authors_dropdown .= '</label>';
787 <?php if ( !$bulk ) echo $authors_dropdown;
788 endif; // post_type_supports author
793 <div class="inline-edit-group">
794 <label class="alignleft">
795 <span class="title"><?php _e( 'Password' ); ?></span>
796 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
799 <em style="margin:5px 10px 0 0" class="alignleft">
801 /* translators: Between password field and private checkbox on post quick edit interface */
802 echo __( '–OR–' );
805 <label class="alignleft inline-edit-private">
806 <input type="checkbox" name="keep_private" value="private" />
807 <span class="checkbox-title"><?php echo __( 'Private' ); ?></span>
815 <?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?>
817 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
819 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
821 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?>
822 <span class="catshow"><?php _e( '[more]' ); ?></span>
823 <span class="cathide" style="display:none;"><?php _e( '[less]' ); ?></span>
825 <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
826 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
827 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
830 <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
834 <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
836 <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
839 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
840 echo $authors_dropdown;
843 <?php if ( $post_type_object->hierarchical ) : ?>
846 <span class="title"><?php _e( 'Parent' ); ?></span>
848 $dropdown_args = array( 'post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __( 'Main Page (no parent)' ), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title' );
850 $dropdown_args['show_option_no_change'] = __( '— No Change —' );
851 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
852 wp_dropdown_pages( $dropdown_args );
856 <?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
860 <span class="title"><?php _e( 'Order' ); ?></span>
861 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
864 <?php endif; // !$bulk ?>
867 <span class="title"><?php _e( 'Template' ); ?></span>
868 <select name="page_template">
869 <?php if ( $bulk ) : ?>
870 <option value="-1"><?php _e( '— No Change —' ); ?></option>
871 <?php endif; // $bulk ?>
872 <option value="default"><?php _e( 'Default Template' ); ?></option>
873 <?php page_template_dropdown() ?>
878 endif; // post_type_supports page-attributes
879 endif; // $post_type_object->hierarchical ?>
881 <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
883 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
885 <label class="inline-edit-tags">
886 <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
887 <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
890 <?php endforeach; //$flat_taxonomies as $taxonomy ?>
892 <?php endif; // count( $flat_taxonomies ) && !$bulk ?>
894 <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
897 <div class="inline-edit-group">
898 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
899 <label class="alignleft">
900 <span class="title"><?php _e( 'Comments' ); ?></span>
901 <select name="comment_status">
902 <option value=""><?php _e( '— No Change —' ); ?></option>
903 <option value="open"><?php _e( 'Allow' ); ?></option>
904 <option value="closed"><?php _e( 'Do not allow' ); ?></option>
907 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
908 <label class="alignright">
909 <span class="title"><?php _e( 'Pings' ); ?></span>
910 <select name="ping_status">
911 <option value=""><?php _e( '— No Change —' ); ?></option>
912 <option value="open"><?php _e( 'Allow' ); ?></option>
913 <option value="closed"><?php _e( 'Do not allow' ); ?></option>
919 <?php else : // $bulk ?>
921 <div class="inline-edit-group">
922 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
923 <label class="alignleft">
924 <input type="checkbox" name="comment_status" value="open" />
925 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
927 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
928 <label class="alignleft">
929 <input type="checkbox" name="ping_status" value="open" />
930 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
935 <?php endif; // $bulk
936 endif; // post_type_supports comments or pings ?>
938 <div class="inline-edit-group">
939 <label class="inline-edit-status alignleft">
940 <span class="title"><?php _e( 'Status' ); ?></span>
941 <select name="_status">
942 <?php if ( $bulk ) : ?>
943 <option value="-1"><?php _e( '— No Change —' ); ?></option>
944 <?php endif; // $bulk ?>
945 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
946 <option value="publish"><?php _e( 'Published' ); ?></option>
947 <option value="future"><?php _e( 'Scheduled' ); ?></option>
948 <?php if ( $bulk ) : ?>
949 <option value="private"><?php _e( 'Private' ) ?></option>
950 <?php endif; // $bulk ?>
952 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
953 <option value="draft"><?php _e( 'Draft' ); ?></option>
957 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
959 <?php if ( $bulk ) : ?>
961 <label class="alignright">
962 <span class="title"><?php _e( 'Sticky' ); ?></span>
963 <select name="sticky">
964 <option value="-1"><?php _e( '— No Change —' ); ?></option>
965 <option value="sticky"><?php _e( 'Sticky' ); ?></option>
966 <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
970 <?php else : // $bulk ?>
972 <label class="alignleft">
973 <input type="checkbox" name="sticky" value="sticky" />
974 <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
977 <?php endif; // $bulk ?>
979 <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
986 list( $columns ) = $this->get_column_info();
988 foreach ( $columns as $column_name => $column_display_name ) {
989 if ( isset( $core_columns[$column_name] ) )
991 do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
994 <p class="submit inline-edit-save">
995 <a accesskey="c" href="#inline-edit" title="<?php _e( 'Cancel' ); ?>" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
996 <?php if ( ! $bulk ) {
997 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
998 $update_text = __( 'Update' );
1000 <a accesskey="s" href="#inline-edit" title="<?php _e( 'Update' ); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
1001 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
1003 submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
1005 <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
1006 <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
1007 <br class="clear" />
1014 </tbody></table></form>