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 __construct() {
49 global $post_type_object, $wpdb;
51 $post_type = get_current_screen()->post_type;
52 $post_type_object = get_post_type_object( $post_type );
54 if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
55 $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
56 SELECT COUNT( 1 ) FROM $wpdb->posts
57 WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
59 ", $post_type, get_current_user_id() ) );
61 if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
62 $_GET['author'] = get_current_user_id();
65 if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
66 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
67 $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 ) );
70 parent::__construct( array(
75 function ajax_user_can() {
76 global $post_type_object;
78 return current_user_can( $post_type_object->cap->edit_posts );
81 function prepare_items() {
82 global $post_type_object, $avail_post_stati, $wp_query, $per_page, $mode;
84 $avail_post_stati = wp_edit_posts_query();
86 $this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] );
88 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
90 $post_type = $post_type_object->name;
91 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
92 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
94 if ( $this->hierarchical_display )
95 $total_pages = ceil( $total_items / $per_page );
97 $total_pages = $wp_query->max_num_pages;
99 $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
101 $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash';
103 $this->set_pagination_args( array(
104 'total_items' => $total_items,
105 'total_pages' => $total_pages,
106 'per_page' => $per_page
110 function has_items() {
114 function no_items() {
115 global $post_type_object;
117 if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
118 echo $post_type_object->labels->not_found_in_trash;
120 echo $post_type_object->labels->not_found;
123 function get_views() {
124 global $post_type_object, $locked_post_status, $avail_post_stati;
126 $post_type = $post_type_object->name;
128 if ( !empty($locked_post_status) )
131 $status_links = array();
132 $num_posts = wp_count_posts( $post_type, 'readable' );
136 $current_user_id = get_current_user_id();
138 if ( $this->user_posts_count ) {
139 if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) )
140 $class = ' class="current"';
141 $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>';
142 $allposts = '&all_posts=1';
145 $total_posts = array_sum( (array) $num_posts );
147 // Subtract post types that are not included in the admin all list.
148 foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
149 $total_posts -= $num_posts->$state;
151 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
152 $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>';
154 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
157 $status_name = $status->name;
159 if ( !in_array( $status_name, $avail_post_stati ) )
162 if ( empty( $num_posts->$status_name ) )
165 if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
166 $class = ' class="current"';
168 $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>';
171 if ( ! empty( $this->sticky_posts_count ) ) {
172 $class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
174 $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>' );
176 // Sticky comes after Publish, or if not listed, after All.
177 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
178 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
181 return $status_links;
184 function get_bulk_actions() {
187 if ( $this->is_trash )
188 $actions['untrash'] = __( 'Restore' );
190 $actions['edit'] = __( 'Edit' );
192 if ( $this->is_trash || !EMPTY_TRASH_DAYS )
193 $actions['delete'] = __( 'Delete Permanently' );
195 $actions['trash'] = __( 'Move to Trash' );
200 function extra_tablenav( $which ) {
201 global $post_type_object, $cat;
203 <div class="alignleft actions">
205 if ( 'top' == $which && !is_singular() ) {
207 $this->months_dropdown( $post_type_object->name );
209 if ( is_object_in_taxonomy( $post_type_object->name, 'category' ) ) {
210 $dropdown_options = array(
211 'show_option_all' => __( 'View all categories' ),
218 wp_dropdown_categories( $dropdown_options );
220 do_action( 'restrict_manage_posts' );
221 submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
224 if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
225 submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false );
232 function current_action() {
233 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
236 return parent::current_action();
239 function pagination( $which ) {
240 global $post_type_object, $mode;
242 parent::pagination( $which );
244 if ( 'top' == $which && !$post_type_object->hierarchical )
245 $this->view_switcher( $mode );
248 function get_table_classes() {
249 global $post_type_object;
251 return array( 'widefat', 'fixed', $post_type_object->hierarchical ? 'pages' : 'posts' );
254 function get_columns() {
255 $screen = get_current_screen();
257 if ( empty( $screen ) )
260 $post_type = $screen->post_type;
262 $posts_columns = array();
264 $posts_columns['cb'] = '<input type="checkbox" />';
266 /* translators: manage posts column name */
267 $posts_columns['title'] = _x( 'Title', 'column name' );
269 if ( post_type_supports( $post_type, 'author' ) )
270 $posts_columns['author'] = __( 'Author' );
272 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) )
273 $posts_columns['categories'] = __( 'Categories' );
275 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) )
276 $posts_columns['tags'] = __( 'Tags' );
278 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
279 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) )
280 $posts_columns['comments'] = '<span class="vers"><img alt="' . esc_attr__( 'Comments' ) . '" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></span>';
282 $posts_columns['date'] = __( 'Date' );
284 if ( 'page' == $post_type )
285 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
287 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
288 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
290 return $posts_columns;
293 function get_sortable_columns() {
296 'author' => 'author',
297 'parent' => 'parent',
298 'comments' => 'comment_count',
299 'date' => array( 'date', true )
303 function display_rows( $posts = array() ) {
304 global $wp_query, $post_type_object, $per_page;
306 if ( empty( $posts ) )
307 $posts = $wp_query->posts;
309 add_filter( 'the_title', 'esc_html' );
311 if ( $this->hierarchical_display ) {
312 $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
314 $this->_display_rows( $posts );
318 function _display_rows( $posts ) {
321 // Create array of post IDs.
324 foreach ( $posts as $a_post )
325 $post_ids[] = $a_post->ID;
327 $this->comment_pending_count = get_pending_comments_num( $post_ids );
329 foreach ( $posts as $post )
330 $this->single_row( $post );
333 function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
339 $pages = get_pages( array( 'sort_column' => 'menu_order' ) );
346 * arrange pages into two parts: top level pages and children_pages
347 * children_pages is two dimensional array, eg.
348 * children_pages[10][] contains all sub-pages whose parent is 10.
349 * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations
350 * If searching, ignore hierarchy and treat everything as top level
352 if ( empty( $_REQUEST['s'] ) ) {
354 $top_level_pages = array();
355 $children_pages = array();
357 foreach ( $pages as $page ) {
359 // catch and repair bad pages
360 if ( $page->post_parent == $page->ID ) {
361 $page->post_parent = 0;
362 $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
363 clean_page_cache( $page->ID );
366 if ( 0 == $page->post_parent )
367 $top_level_pages[] = $page;
369 $children_pages[ $page->post_parent ][] = $page;
372 $pages = &$top_level_pages;
376 $start = ( $pagenum - 1 ) * $per_page;
377 $end = $start + $per_page;
379 foreach ( $pages as $page ) {
380 if ( $count >= $end )
383 if ( $count >= $start )
384 echo "\t" . $this->single_row( $page, $level );
388 if ( isset( $children_pages ) )
389 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
392 // if it is the last pagenum and there are orphaned pages, display them with paging as well
393 if ( isset( $children_pages ) && $count < $end ){
394 foreach ( $children_pages as $orphans ){
395 foreach ( $orphans as $op ) {
396 if ( $count >= $end )
398 if ( $count >= $start )
399 echo "\t" . $this->single_row( $op, 0 );
407 * Given a top level page ID, display the nested hierarchy of sub-pages
408 * together with paging support
410 * @since 3.1.0 (Standalone function exists since 2.6.0)
412 * @param unknown_type $children_pages
413 * @param unknown_type $count
414 * @param unknown_type $parent
415 * @param unknown_type $level
416 * @param unknown_type $pagenum
417 * @param unknown_type $per_page
419 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
421 if ( ! isset( $children_pages[$parent] ) )
424 $start = ( $pagenum - 1 ) * $per_page;
425 $end = $start + $per_page;
427 foreach ( $children_pages[$parent] as $page ) {
429 if ( $count >= $end )
432 // If the page starts in a subtree, print the parents.
433 if ( $count == $start && $page->post_parent > 0 ) {
434 $my_parents = array();
435 $my_parent = $page->post_parent;
436 while ( $my_parent ) {
437 $my_parent = get_post( $my_parent );
438 $my_parents[] = $my_parent;
439 if ( !$my_parent->post_parent )
441 $my_parent = $my_parent->post_parent;
443 $num_parents = count( $my_parents );
444 while ( $my_parent = array_pop( $my_parents ) ) {
445 echo "\t" . $this->single_row( $my_parent, $level - $num_parents );
450 if ( $count >= $start )
451 echo "\t" . $this->single_row( $page, $level );
455 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
458 unset( $children_pages[$parent] ); //required in order to keep track of orphans
461 function single_row( $a_post, $level = 0 ) {
465 $global_post = $post;
467 setup_postdata( $post );
469 $edit_link = get_edit_post_link( $post->ID );
470 $title = _draft_or_post_title();
471 $post_type_object = get_post_type_object( $post->post_type );
472 $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
474 $alternate = 'alternate' == $alternate ? '' : 'alternate';
475 $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
477 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>" valign="top">
480 list( $columns, $hidden ) = $this->get_column_info();
482 foreach ( $columns as $column_name => $column_display_name ) {
483 $class = "class=\"$column_name column-$column_name\"";
486 if ( in_array( $column_name, $hidden ) )
487 $style = ' style="display:none;"';
489 $attributes = "$class$style";
491 switch ( $column_name ) {
495 <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
500 if ( $this->hierarchical_display ) {
501 $attributes = 'class="post-title page-title column-title"' . $style;
503 if ( 0 == $level && (int) $post->post_parent > 0 ) {
504 //sent level 0 by accident, by default, or because we don't know the actual level
505 $find_main_page = (int) $post->post_parent;
506 while ( $find_main_page > 0 ) {
507 $parent = get_page( $find_main_page );
509 if ( is_null( $parent ) )
513 $find_main_page = (int) $parent->post_parent;
515 if ( !isset( $parent_name ) )
516 $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
520 $pad = str_repeat( '— ', $level );
522 <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>
526 $attributes = 'class="post-title page-title column-title"' . $style;
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 $title ?></a><?php } else { echo $title; }; _post_states( $post ); ?></strong>
530 if ( 'excerpt' == $mode ) {
536 if ( $can_edit_post && 'trash' != $post->post_status ) {
537 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
538 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>';
540 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
541 if ( 'trash' == $post->post_status )
542 $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>";
543 elseif ( EMPTY_TRASH_DAYS )
544 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
545 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
546 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
548 if ( $post_type_object->public ) {
549 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
550 if ( $can_edit_post )
551 $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>';
552 } elseif ( 'trash' != $post->post_status ) {
553 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
557 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
558 echo $this->row_actions( $actions );
560 get_inline_data( $post );
565 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
566 $t_time = $h_time = __( 'Unpublished' );
569 $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
570 $m_time = $post->post_date;
571 $time = get_post_time( 'G', true, $post );
573 $time_diff = time() - $time;
575 if ( $time_diff > 0 && $time_diff < 24*60*60 )
576 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
578 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
581 echo '<td ' . $attributes . '>';
582 if ( 'excerpt' == $mode )
583 echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
585 echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
587 if ( 'publish' == $post->post_status ) {
589 } elseif ( 'future' == $post->post_status ) {
590 if ( $time_diff > 0 )
591 echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
595 _e( 'Last Modified' );
602 <td <?php echo $attributes ?>><?php
603 $categories = get_the_category();
604 if ( !empty( $categories ) ) {
606 foreach ( $categories as $c ) {
607 $out[] = sprintf( '<a href="%s">%s</a>',
608 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ),
609 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) )
612 echo join( ', ', $out );
614 _e( 'Uncategorized' );
622 <td <?php echo $attributes ?>><?php
623 $tags = get_the_tags( $post->ID );
624 if ( !empty( $tags ) ) {
626 foreach ( $tags as $c ) {
627 $out[] = sprintf( '<a href="%s">%s</a>',
628 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ),
629 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) )
632 echo join( ', ', $out );
642 <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
644 $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
646 $this->comments_bubble( $post->ID, $pending_comments );
654 <td <?php echo $attributes ?>><?php
655 printf( '<a href="%s">%s</a>',
656 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
665 <td <?php echo $attributes ?>><?php
666 if ( is_post_type_hierarchical( $post->post_type ) )
667 do_action( 'manage_pages_custom_column', $column_name, $post->ID );
669 do_action( 'manage_posts_custom_column', $column_name, $post->ID );
670 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
679 $post = $global_post;
683 * Outputs the hidden row displayed when inline editing
687 function inline_edit() {
690 $screen = get_current_screen();
692 $post = get_default_post_to_edit( $screen->post_type );
693 $post_type_object = get_post_type_object( $screen->post_type );
695 $taxonomy_names = get_object_taxonomies( $screen->post_type );
696 $hierarchical_taxonomies = array();
697 $flat_taxonomies = array();
698 foreach ( $taxonomy_names as $taxonomy_name ) {
699 $taxonomy = get_taxonomy( $taxonomy_name );
701 if ( !$taxonomy->show_ui )
704 if ( $taxonomy->hierarchical )
705 $hierarchical_taxonomies[] = $taxonomy;
707 $flat_taxonomies[] = $taxonomy;
710 $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
711 $can_publish = current_user_can( $post_type_object->cap->publish_posts );
712 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
716 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
718 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
720 while ( $bulk < 2 ) { ?>
722 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
723 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";
724 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
726 <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
727 <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
730 if ( post_type_supports( $screen->post_type, 'title' ) ) :
732 <div id="bulk-title-div">
733 <div id="bulk-titles"></div>
736 <?php else : // $bulk ?>
739 <span class="title"><?php _e( 'Title' ); ?></span>
740 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
744 <span class="title"><?php _e( 'Slug' ); ?></span>
745 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
748 <?php endif; // $bulk
749 endif; // post_type_supports title ?>
751 <?php if ( !$bulk ) : ?>
752 <label><span class="title"><?php _e( 'Date' ); ?></span></label>
753 <div class="inline-edit-date">
754 <?php touch_time( 1, 1, 4, 1 ); ?>
757 <?php endif; // $bulk
759 if ( post_type_supports( $screen->post_type, 'author' ) ) :
760 $authors_dropdown = '';
762 if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
764 'hide_if_only_one_author' => false,
766 'name' => 'post_author',
772 $users_opt['show_option_none'] = __( '— No Change —' );
774 if ( $authors = wp_dropdown_users( $users_opt ) ) :
775 $authors_dropdown = '<label class="inline-edit-author">';
776 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
777 $authors_dropdown .= $authors;
778 $authors_dropdown .= '</label>';
783 <?php if ( !$bulk ) echo $authors_dropdown;
784 endif; // post_type_supports author
789 <div class="inline-edit-group">
790 <label class="alignleft">
791 <span class="title"><?php _e( 'Password' ); ?></span>
792 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
795 <em style="margin:5px 10px 0 0" class="alignleft">
797 /* translators: Between password field and private checkbox on post quick edit interface */
798 echo __( '–OR–' );
801 <label class="alignleft inline-edit-private">
802 <input type="checkbox" name="keep_private" value="private" />
803 <span class="checkbox-title"><?php echo __( 'Private' ); ?></span>
811 <?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?>
813 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
815 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
817 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?>
818 <span class="catshow"><?php _e( '[more]' ); ?></span>
819 <span class="cathide" style="display:none;"><?php _e( '[less]' ); ?></span>
821 <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
822 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
823 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
826 <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
830 <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
832 <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
835 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
836 echo $authors_dropdown;
838 if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
840 if ( $post_type_object->hierarchical ) :
843 <span class="title"><?php _e( 'Parent' ); ?></span>
845 $dropdown_args = array(
846 'post_type' => $post_type_object->name,
847 'selected' => $post->post_parent,
848 'name' => 'post_parent',
849 'show_option_none' => __( 'Main Page (no parent)' ),
850 'option_none_value' => 0,
851 'sort_column' => 'menu_order, post_title',
855 $dropdown_args['show_option_no_change'] = __( '— No Change —' );
856 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
857 wp_dropdown_pages( $dropdown_args );
862 endif; // hierarchical
867 <span class="title"><?php _e( 'Order' ); ?></span>
868 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
871 <?php endif; // !$bulk
873 if ( 'page' == $screen->post_type ) :
877 <span class="title"><?php _e( 'Template' ); ?></span>
878 <select name="page_template">
879 <?php if ( $bulk ) : ?>
880 <option value="-1"><?php _e( '— No Change —' ); ?></option>
881 <?php endif; // $bulk ?>
882 <option value="default"><?php _e( 'Default Template' ); ?></option>
883 <?php page_template_dropdown() ?>
888 endif; // page post_type
889 endif; // page-attributes
892 <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
894 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
895 <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
896 <label class="inline-edit-tags">
897 <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
898 <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
902 <?php endforeach; //$flat_taxonomies as $taxonomy ?>
904 <?php endif; // count( $flat_taxonomies ) && !$bulk ?>
906 <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
909 <div class="inline-edit-group">
910 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
911 <label class="alignleft">
912 <span class="title"><?php _e( 'Comments' ); ?></span>
913 <select name="comment_status">
914 <option value=""><?php _e( '— No Change —' ); ?></option>
915 <option value="open"><?php _e( 'Allow' ); ?></option>
916 <option value="closed"><?php _e( 'Do not allow' ); ?></option>
919 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
920 <label class="alignright">
921 <span class="title"><?php _e( 'Pings' ); ?></span>
922 <select name="ping_status">
923 <option value=""><?php _e( '— No Change —' ); ?></option>
924 <option value="open"><?php _e( 'Allow' ); ?></option>
925 <option value="closed"><?php _e( 'Do not allow' ); ?></option>
931 <?php else : // $bulk ?>
933 <div class="inline-edit-group">
934 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
935 <label class="alignleft">
936 <input type="checkbox" name="comment_status" value="open" />
937 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
939 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
940 <label class="alignleft">
941 <input type="checkbox" name="ping_status" value="open" />
942 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
947 <?php endif; // $bulk
948 endif; // post_type_supports comments or pings ?>
950 <div class="inline-edit-group">
951 <label class="inline-edit-status alignleft">
952 <span class="title"><?php _e( 'Status' ); ?></span>
953 <select name="_status">
954 <?php if ( $bulk ) : ?>
955 <option value="-1"><?php _e( '— No Change —' ); ?></option>
956 <?php endif; // $bulk ?>
957 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
958 <option value="publish"><?php _e( 'Published' ); ?></option>
959 <option value="future"><?php _e( 'Scheduled' ); ?></option>
960 <?php if ( $bulk ) : ?>
961 <option value="private"><?php _e( 'Private' ) ?></option>
962 <?php endif; // $bulk ?>
964 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
965 <option value="draft"><?php _e( 'Draft' ); ?></option>
969 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
971 <?php if ( $bulk ) : ?>
973 <label class="alignright">
974 <span class="title"><?php _e( 'Sticky' ); ?></span>
975 <select name="sticky">
976 <option value="-1"><?php _e( '— No Change —' ); ?></option>
977 <option value="sticky"><?php _e( 'Sticky' ); ?></option>
978 <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
982 <?php else : // $bulk ?>
984 <label class="alignleft">
985 <input type="checkbox" name="sticky" value="sticky" />
986 <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
989 <?php endif; // $bulk ?>
991 <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
995 <?php if ( post_type_supports( $screen->post_type, 'post-formats' ) && current_theme_supports( 'post-formats' ) ) :
996 $post_formats = get_theme_support( 'post-formats' );
997 if ( isset( $post_formats[0] ) && is_array( $post_formats[0] ) ) :
998 $all_post_formats = get_post_format_strings(); ?>
999 <div class="inline-edit-group">
1000 <label class="alignleft" for="post_format">
1001 <span class="title"><?php _e( 'Post Format' ); ?></span>
1002 <select name="post_format">
1003 <?php if ( $bulk ) : ?>
1004 <option value="-1"><?php _e( '— No Change —' ); ?></option>
1006 <option value="0"><?php _ex( 'Standard', 'Post format' ); ?></option>
1007 <?php foreach ( $all_post_formats as $slug => $format ):
1008 if ( $slug != 'standard' ) : ?>
1009 <option value="<?php echo esc_attr( $slug ); ?>"<?php if ( ! in_array( $slug, $post_formats[0] ) ) echo ' class="unsupported"'; ?>><?php echo esc_html( $format ); ?></option>
1015 <?php endif; // post-formats ?>
1020 list( $columns ) = $this->get_column_info();
1022 foreach ( $columns as $column_name => $column_display_name ) {
1023 if ( isset( $core_columns[$column_name] ) )
1025 do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
1028 <p class="submit inline-edit-save">
1029 <a accesskey="c" href="#inline-edit" title="<?php esc_attr_e( 'Cancel' ); ?>" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
1030 <?php if ( ! $bulk ) {
1031 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
1032 $update_text = __( 'Update' );
1034 <a accesskey="s" href="#inline-edit" title="<?php esc_attr_e( 'Update' ); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
1035 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
1037 submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
1039 <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
1040 <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
1041 <span class="error" style="display:none"></span>
1042 <br class="clear" />
1049 </tbody></table></form>