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 add_filter( 'the_title', 'esc_html' );
315 if ( $this->hierarchical_display ) {
316 $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
318 $this->_display_rows( $posts );
322 function _display_rows( $posts ) {
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 $pad = str_repeat( '— ', $level );
527 <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>
531 $attributes = 'class="post-title page-title column-title"' . $style;
533 <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>
535 if ( 'excerpt' == $mode ) {
541 if ( $can_edit_post && 'trash' != $post->post_status ) {
542 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
543 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>';
545 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
546 if ( 'trash' == $post->post_status )
547 $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>";
548 elseif ( EMPTY_TRASH_DAYS )
549 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
550 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
551 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
553 if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
554 if ( $can_edit_post )
555 $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>';
556 } elseif ( 'trash' != $post->post_status ) {
557 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
560 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
561 echo $this->row_actions( $actions );
563 get_inline_data( $post );
568 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
569 $t_time = $h_time = __( 'Unpublished' );
572 $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
573 $m_time = $post->post_date;
574 $time = get_post_time( 'G', true, $post );
576 $time_diff = time() - $time;
578 if ( $time_diff > 0 && $time_diff < 24*60*60 )
579 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
581 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
584 echo '<td ' . $attributes . '>';
585 if ( 'excerpt' == $mode )
586 echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
588 echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
590 if ( 'publish' == $post->post_status ) {
592 } elseif ( 'future' == $post->post_status ) {
593 if ( $time_diff > 0 )
594 echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
598 _e( 'Last Modified' );
605 <td <?php echo $attributes ?>><?php
606 $categories = get_the_category();
607 if ( !empty( $categories ) ) {
609 foreach ( $categories as $c ) {
610 $out[] = sprintf( '<a href="%s">%s</a>',
611 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ),
612 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) )
615 echo join( ', ', $out );
617 _e( 'Uncategorized' );
625 <td <?php echo $attributes ?>><?php
626 $tags = get_the_tags( $post->ID );
627 if ( !empty( $tags ) ) {
629 foreach ( $tags as $c ) {
630 $out[] = sprintf( '<a href="%s">%s</a>',
631 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ),
632 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) )
635 echo join( ', ', $out );
645 <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
647 $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
649 $this->comments_bubble( $post->ID, $pending_comments );
657 <td <?php echo $attributes ?>><?php
658 printf( '<a href="%s">%s</a>',
659 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
668 <td <?php echo $attributes ?>><?php
669 if ( is_post_type_hierarchical( $post->post_type ) )
670 do_action( 'manage_pages_custom_column', $column_name, $post->ID );
672 do_action( 'manage_posts_custom_column', $column_name, $post->ID );
673 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
682 $post = $global_post;
686 * Outputs the hidden row displayed when inline editing
690 function inline_edit() {
693 $screen = get_current_screen();
695 $post = get_default_post_to_edit( $screen->post_type );
696 $post_type_object = get_post_type_object( $screen->post_type );
698 $taxonomy_names = get_object_taxonomies( $screen->post_type );
699 $hierarchical_taxonomies = array();
700 $flat_taxonomies = array();
701 foreach ( $taxonomy_names as $taxonomy_name ) {
702 $taxonomy = get_taxonomy( $taxonomy_name );
704 if ( !$taxonomy->show_ui )
707 if ( $taxonomy->hierarchical )
708 $hierarchical_taxonomies[] = $taxonomy;
710 $flat_taxonomies[] = $taxonomy;
713 $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
714 $can_publish = current_user_can( $post_type_object->cap->publish_posts );
715 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
719 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
721 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
723 while ( $bulk < 2 ) { ?>
725 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
726 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";
727 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
729 <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
730 <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
733 if ( post_type_supports( $screen->post_type, 'title' ) ) :
735 <div id="bulk-title-div">
736 <div id="bulk-titles"></div>
739 <?php else : // $bulk ?>
742 <span class="title"><?php _e( 'Title' ); ?></span>
743 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
747 <span class="title"><?php _e( 'Slug' ); ?></span>
748 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
751 <?php endif; // $bulk
752 endif; // post_type_supports title ?>
754 <?php if ( !$bulk ) : ?>
755 <label><span class="title"><?php _e( 'Date' ); ?></span></label>
756 <div class="inline-edit-date">
757 <?php touch_time( 1, 1, 4, 1 ); ?>
760 <?php endif; // $bulk
762 if ( post_type_supports( $screen->post_type, 'author' ) ) :
763 $authors_dropdown = '';
765 if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
767 'hide_if_only_one_author' => false,
769 'name' => 'post_author',
775 $users_opt['show_option_none'] = __( '— No Change —' );
777 if ( $authors = wp_dropdown_users( $users_opt ) ) :
778 $authors_dropdown = '<label class="inline-edit-author">';
779 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
780 $authors_dropdown .= $authors;
781 $authors_dropdown .= '</label>';
786 <?php if ( !$bulk ) echo $authors_dropdown;
787 endif; // post_type_supports author
792 <div class="inline-edit-group">
793 <label class="alignleft">
794 <span class="title"><?php _e( 'Password' ); ?></span>
795 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
798 <em style="margin:5px 10px 0 0" class="alignleft">
800 /* translators: Between password field and private checkbox on post quick edit interface */
801 echo __( '–OR–' );
804 <label class="alignleft inline-edit-private">
805 <input type="checkbox" name="keep_private" value="private" />
806 <span class="checkbox-title"><?php echo __( 'Private' ); ?></span>
814 <?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?>
816 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
818 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
820 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?>
821 <span class="catshow"><?php _e( '[more]' ); ?></span>
822 <span class="cathide" style="display:none;"><?php _e( '[less]' ); ?></span>
824 <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
825 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
826 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
829 <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
833 <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
835 <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
838 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
839 echo $authors_dropdown;
842 <?php if ( $post_type_object->hierarchical ) : ?>
845 <span class="title"><?php _e( 'Parent' ); ?></span>
847 $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' );
849 $dropdown_args['show_option_no_change'] = __( '— No Change —' );
850 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
851 wp_dropdown_pages( $dropdown_args );
855 <?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
859 <span class="title"><?php _e( 'Order' ); ?></span>
860 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
863 <?php endif; // !$bulk ?>
866 <span class="title"><?php _e( 'Template' ); ?></span>
867 <select name="page_template">
868 <?php if ( $bulk ) : ?>
869 <option value="-1"><?php _e( '— No Change —' ); ?></option>
870 <?php endif; // $bulk ?>
871 <option value="default"><?php _e( 'Default Template' ); ?></option>
872 <?php page_template_dropdown() ?>
877 endif; // post_type_supports page-attributes
878 endif; // $post_type_object->hierarchical ?>
880 <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
882 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
884 <label class="inline-edit-tags">
885 <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
886 <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
889 <?php endforeach; //$flat_taxonomies as $taxonomy ?>
891 <?php endif; // count( $flat_taxonomies ) && !$bulk ?>
893 <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
896 <div class="inline-edit-group">
897 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
898 <label class="alignleft">
899 <span class="title"><?php _e( 'Comments' ); ?></span>
900 <select name="comment_status">
901 <option value=""><?php _e( '— No Change —' ); ?></option>
902 <option value="open"><?php _e( 'Allow' ); ?></option>
903 <option value="closed"><?php _e( 'Do not allow' ); ?></option>
906 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
907 <label class="alignright">
908 <span class="title"><?php _e( 'Pings' ); ?></span>
909 <select name="ping_status">
910 <option value=""><?php _e( '— No Change —' ); ?></option>
911 <option value="open"><?php _e( 'Allow' ); ?></option>
912 <option value="closed"><?php _e( 'Do not allow' ); ?></option>
918 <?php else : // $bulk ?>
920 <div class="inline-edit-group">
921 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
922 <label class="alignleft">
923 <input type="checkbox" name="comment_status" value="open" />
924 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
926 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
927 <label class="alignleft">
928 <input type="checkbox" name="ping_status" value="open" />
929 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
934 <?php endif; // $bulk
935 endif; // post_type_supports comments or pings ?>
937 <div class="inline-edit-group">
938 <label class="inline-edit-status alignleft">
939 <span class="title"><?php _e( 'Status' ); ?></span>
940 <select name="_status">
941 <?php if ( $bulk ) : ?>
942 <option value="-1"><?php _e( '— No Change —' ); ?></option>
943 <?php endif; // $bulk ?>
944 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
945 <option value="publish"><?php _e( 'Published' ); ?></option>
946 <option value="future"><?php _e( 'Scheduled' ); ?></option>
947 <?php if ( $bulk ) : ?>
948 <option value="private"><?php _e( 'Private' ) ?></option>
949 <?php endif; // $bulk ?>
951 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
952 <option value="draft"><?php _e( 'Draft' ); ?></option>
956 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
958 <?php if ( $bulk ) : ?>
960 <label class="alignright">
961 <span class="title"><?php _e( 'Sticky' ); ?></span>
962 <select name="sticky">
963 <option value="-1"><?php _e( '— No Change —' ); ?></option>
964 <option value="sticky"><?php _e( 'Sticky' ); ?></option>
965 <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
969 <?php else : // $bulk ?>
971 <label class="alignleft">
972 <input type="checkbox" name="sticky" value="sticky" />
973 <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
976 <?php endif; // $bulk ?>
978 <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
985 list( $columns ) = $this->get_column_info();
987 foreach ( $columns as $column_name => $column_display_name ) {
988 if ( isset( $core_columns[$column_name] ) )
990 do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
993 <p class="submit inline-edit-save">
994 <a accesskey="c" href="#inline-edit" title="<?php _e( 'Cancel' ); ?>" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
995 <?php if ( ! $bulk ) {
996 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
997 $update_text = __( 'Update' );
999 <a accesskey="s" href="#inline-edit" title="<?php _e( 'Update' ); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
1000 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
1002 submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
1004 <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
1005 <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
1006 <br class="clear" />
1013 </tbody></table></form>