changeset 9 | 177826044cd9 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
8:c7c34916027a | 9:177826044cd9 |
---|---|
72 * @param array $args An associative array of arguments. |
72 * @param array $args An associative array of arguments. |
73 */ |
73 */ |
74 public function __construct( $args = array() ) { |
74 public function __construct( $args = array() ) { |
75 global $post_type_object, $wpdb; |
75 global $post_type_object, $wpdb; |
76 |
76 |
77 parent::__construct( array( |
77 parent::__construct( |
78 'plural' => 'posts', |
78 array( |
79 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
79 'plural' => 'posts', |
80 ) ); |
80 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
81 ) |
|
82 ); |
|
81 |
83 |
82 $post_type = $this->screen->post_type; |
84 $post_type = $this->screen->post_type; |
83 $post_type_object = get_post_type_object( $post_type ); |
85 $post_type_object = get_post_type_object( $post_type ); |
84 |
86 |
85 $exclude_states = get_post_stati( array( |
87 $exclude_states = get_post_stati( |
86 'show_in_admin_all_list' => false, |
88 array( |
87 ) ); |
89 'show_in_admin_all_list' => false, |
88 $this->user_posts_count = intval( $wpdb->get_var( $wpdb->prepare( " |
90 ) |
91 ); |
|
92 $this->user_posts_count = intval( |
|
93 $wpdb->get_var( |
|
94 $wpdb->prepare( |
|
95 " |
|
89 SELECT COUNT( 1 ) |
96 SELECT COUNT( 1 ) |
90 FROM $wpdb->posts |
97 FROM $wpdb->posts |
91 WHERE post_type = %s |
98 WHERE post_type = %s |
92 AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) |
99 AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) |
93 AND post_author = %d |
100 AND post_author = %d |
94 ", $post_type, get_current_user_id() ) ) ); |
101 ", |
102 $post_type, |
|
103 get_current_user_id() |
|
104 ) |
|
105 ) |
|
106 ); |
|
95 |
107 |
96 if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) { |
108 if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) { |
97 $_GET['author'] = get_current_user_id(); |
109 $_GET['author'] = get_current_user_id(); |
98 } |
110 } |
99 |
111 |
100 if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { |
112 if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { |
101 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); |
113 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); |
102 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) ); |
114 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) ); |
103 } |
115 } |
104 } |
116 } |
105 |
117 |
106 /** |
118 /** |
113 public function set_hierarchical_display( $display ) { |
125 public function set_hierarchical_display( $display ) { |
114 $this->hierarchical_display = $display; |
126 $this->hierarchical_display = $display; |
115 } |
127 } |
116 |
128 |
117 /** |
129 /** |
118 * |
|
119 * @return bool |
130 * @return bool |
120 */ |
131 */ |
121 public function ajax_user_can() { |
132 public function ajax_user_can() { |
122 return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); |
133 return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); |
123 } |
134 } |
124 |
135 |
125 /** |
136 /** |
126 * |
|
127 * @global array $avail_post_stati |
137 * @global array $avail_post_stati |
128 * @global WP_Query $wp_query |
138 * @global WP_Query $wp_query |
129 * @global int $per_page |
139 * @global int $per_page |
130 * @global string $mode |
140 * @global string $mode |
131 */ |
141 */ |
136 $avail_post_stati = wp_edit_posts_query(); |
146 $avail_post_stati = wp_edit_posts_query(); |
137 |
147 |
138 $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] ); |
148 $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] ); |
139 |
149 |
140 $post_type = $this->screen->post_type; |
150 $post_type = $this->screen->post_type; |
141 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); |
151 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); |
142 |
152 |
143 /** This filter is documented in wp-admin/includes/post.php */ |
153 /** This filter is documented in wp-admin/includes/post.php */ |
144 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); |
154 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); |
145 |
155 |
146 if ( $this->hierarchical_display ) { |
156 if ( $this->hierarchical_display ) { |
147 $total_items = $wp_query->post_count; |
157 $total_items = $wp_query->post_count; |
148 } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { |
158 } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { |
149 $total_items = $wp_query->found_posts; |
159 $total_items = $wp_query->found_posts; |
150 } else { |
160 } else { |
151 $post_counts = (array) wp_count_posts( $post_type, 'readable' ); |
161 $post_counts = (array) wp_count_posts( $post_type, 'readable' ); |
152 |
162 |
153 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'] , $avail_post_stati ) ) { |
163 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati ) ) { |
154 $total_items = $post_counts[ $_REQUEST['post_status'] ]; |
164 $total_items = $post_counts[ $_REQUEST['post_status'] ]; |
155 } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { |
165 } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { |
156 $total_items = $this->sticky_posts_count; |
166 $total_items = $this->sticky_posts_count; |
157 } elseif ( isset( $_GET['author'] ) && $_GET['author'] == get_current_user_id() ) { |
167 } elseif ( isset( $_GET['author'] ) && $_GET['author'] == get_current_user_id() ) { |
158 $total_items = $this->user_posts_count; |
168 $total_items = $this->user_posts_count; |
173 $mode = get_user_setting( 'posts_list_mode', 'list' ); |
183 $mode = get_user_setting( 'posts_list_mode', 'list' ); |
174 } |
184 } |
175 |
185 |
176 $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash'; |
186 $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash'; |
177 |
187 |
178 $this->set_pagination_args( array( |
188 $this->set_pagination_args( |
179 'total_items' => $total_items, |
189 array( |
180 'per_page' => $per_page |
190 'total_items' => $total_items, |
181 ) ); |
191 'per_page' => $per_page, |
182 } |
192 ) |
183 |
193 ); |
184 /** |
194 } |
185 * |
195 |
196 /** |
|
186 * @return bool |
197 * @return bool |
187 */ |
198 */ |
188 public function has_items() { |
199 public function has_items() { |
189 return have_posts(); |
200 return have_posts(); |
190 } |
201 } |
191 |
202 |
192 /** |
203 /** |
193 */ |
204 */ |
194 public function no_items() { |
205 public function no_items() { |
195 if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) |
206 if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
196 echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; |
207 echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; |
197 else |
208 } else { |
198 echo get_post_type_object( $this->screen->post_type )->labels->not_found; |
209 echo get_post_type_object( $this->screen->post_type )->labels->not_found; |
210 } |
|
199 } |
211 } |
200 |
212 |
201 /** |
213 /** |
202 * Determine if the current view is the "All" view. |
214 * Determine if the current view is the "All" view. |
203 * |
215 * |
221 /** |
233 /** |
222 * Helper to create links to edit.php with params. |
234 * Helper to create links to edit.php with params. |
223 * |
235 * |
224 * @since 4.4.0 |
236 * @since 4.4.0 |
225 * |
237 * |
226 * @param array $args URL parameters for the link. |
238 * @param string[] $args Associative array of URL parameters for the link. |
227 * @param string $label Link text. |
239 * @param string $label Link text. |
228 * @param string $class Optional. Class attribute. Default empty string. |
240 * @param string $class Optional. Class attribute. Default empty string. |
229 * @return string The formatted link string. |
241 * @return string The formatted link string. |
230 */ |
242 */ |
231 protected function get_edit_link( $args, $label, $class = '' ) { |
243 protected function get_edit_link( $args, $label, $class = '' ) { |
232 $url = add_query_arg( $args, 'edit.php' ); |
244 $url = add_query_arg( $args, 'edit.php' ); |
233 |
245 |
234 $class_html = $aria_current = ''; |
246 $class_html = $aria_current = ''; |
235 if ( ! empty( $class ) ) { |
247 if ( ! empty( $class ) ) { |
236 $class_html = sprintf( |
248 $class_html = sprintf( |
237 ' class="%s"', |
249 ' class="%s"', |
238 esc_attr( $class ) |
250 esc_attr( $class ) |
239 ); |
251 ); |
240 |
252 |
241 if ( 'current' === $class ) { |
253 if ( 'current' === $class ) { |
251 $label |
263 $label |
252 ); |
264 ); |
253 } |
265 } |
254 |
266 |
255 /** |
267 /** |
256 * |
|
257 * @global array $locked_post_status This seems to be deprecated. |
268 * @global array $locked_post_status This seems to be deprecated. |
258 * @global array $avail_post_stati |
269 * @global array $avail_post_stati |
259 * @return array |
270 * @return array |
260 */ |
271 */ |
261 protected function get_views() { |
272 protected function get_views() { |
262 global $locked_post_status, $avail_post_stati; |
273 global $locked_post_status, $avail_post_stati; |
263 |
274 |
264 $post_type = $this->screen->post_type; |
275 $post_type = $this->screen->post_type; |
265 |
276 |
266 if ( !empty($locked_post_status) ) |
277 if ( ! empty( $locked_post_status ) ) { |
267 return array(); |
278 return array(); |
279 } |
|
268 |
280 |
269 $status_links = array(); |
281 $status_links = array(); |
270 $num_posts = wp_count_posts( $post_type, 'readable' ); |
282 $num_posts = wp_count_posts( $post_type, 'readable' ); |
271 $total_posts = array_sum( (array) $num_posts ); |
283 $total_posts = array_sum( (array) $num_posts ); |
272 $class = ''; |
284 $class = ''; |
273 |
285 |
274 $current_user_id = get_current_user_id(); |
286 $current_user_id = get_current_user_id(); |
275 $all_args = array( 'post_type' => $post_type ); |
287 $all_args = array( 'post_type' => $post_type ); |
276 $mine = ''; |
288 $mine = ''; |
277 |
289 |
278 // Subtract post types that are not included in the admin all list. |
290 // Subtract post types that are not included in the admin all list. |
279 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { |
291 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { |
280 $total_posts -= $num_posts->$state; |
292 $total_posts -= $num_posts->$state; |
281 } |
293 } |
285 $class = 'current'; |
297 $class = 'current'; |
286 } |
298 } |
287 |
299 |
288 $mine_args = array( |
300 $mine_args = array( |
289 'post_type' => $post_type, |
301 'post_type' => $post_type, |
290 'author' => $current_user_id |
302 'author' => $current_user_id, |
291 ); |
303 ); |
292 |
304 |
293 $mine_inner_html = sprintf( |
305 $mine_inner_html = sprintf( |
294 _nx( |
306 _nx( |
295 'Mine <span class="count">(%s)</span>', |
307 'Mine <span class="count">(%s)</span>', |
301 ); |
313 ); |
302 |
314 |
303 $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); |
315 $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); |
304 |
316 |
305 $all_args['all_posts'] = 1; |
317 $all_args['all_posts'] = 1; |
306 $class = ''; |
318 $class = ''; |
307 } |
319 } |
308 |
320 |
309 if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { |
321 if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { |
310 $class = 'current'; |
322 $class = 'current'; |
311 } |
323 } |
323 $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); |
335 $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); |
324 if ( $mine ) { |
336 if ( $mine ) { |
325 $status_links['mine'] = $mine; |
337 $status_links['mine'] = $mine; |
326 } |
338 } |
327 |
339 |
328 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) { |
340 foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) { |
329 $class = ''; |
341 $class = ''; |
330 |
342 |
331 $status_name = $status->name; |
343 $status_name = $status->name; |
332 |
344 |
333 if ( ! in_array( $status_name, $avail_post_stati ) || empty( $num_posts->$status_name ) ) { |
345 if ( ! in_array( $status_name, $avail_post_stati ) || empty( $num_posts->$status_name ) ) { |
334 continue; |
346 continue; |
335 } |
347 } |
336 |
348 |
337 if ( isset($_REQUEST['post_status']) && $status_name === $_REQUEST['post_status'] ) { |
349 if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) { |
338 $class = 'current'; |
350 $class = 'current'; |
339 } |
351 } |
340 |
352 |
341 $status_args = array( |
353 $status_args = array( |
342 'post_status' => $status_name, |
354 'post_status' => $status_name, |
343 'post_type' => $post_type, |
355 'post_type' => $post_type, |
344 ); |
356 ); |
345 |
357 |
346 $status_label = sprintf( |
358 $status_label = sprintf( |
347 translate_nooped_plural( $status->label_count, $num_posts->$status_name ), |
359 translate_nooped_plural( $status->label_count, $num_posts->$status_name ), |
348 number_format_i18n( $num_posts->$status_name ) |
360 number_format_i18n( $num_posts->$status_name ) |
353 |
365 |
354 if ( ! empty( $this->sticky_posts_count ) ) { |
366 if ( ! empty( $this->sticky_posts_count ) ) { |
355 $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : ''; |
367 $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : ''; |
356 |
368 |
357 $sticky_args = array( |
369 $sticky_args = array( |
358 'post_type' => $post_type, |
370 'post_type' => $post_type, |
359 'show_sticky' => 1 |
371 'show_sticky' => 1, |
360 ); |
372 ); |
361 |
373 |
362 $sticky_inner_html = sprintf( |
374 $sticky_inner_html = sprintf( |
363 _nx( |
375 _nx( |
364 'Sticky <span class="count">(%s)</span>', |
376 'Sticky <span class="count">(%s)</span>', |
368 ), |
380 ), |
369 number_format_i18n( $this->sticky_posts_count ) |
381 number_format_i18n( $this->sticky_posts_count ) |
370 ); |
382 ); |
371 |
383 |
372 $sticky_link = array( |
384 $sticky_link = array( |
373 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ) |
385 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), |
374 ); |
386 ); |
375 |
387 |
376 // Sticky comes after Publish, or if not listed, after All. |
388 // Sticky comes after Publish, or if not listed, after All. |
377 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) ); |
389 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) ); |
378 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); |
390 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); |
379 } |
391 } |
380 |
392 |
381 return $status_links; |
393 return $status_links; |
382 } |
394 } |
383 |
395 |
384 /** |
396 /** |
385 * |
|
386 * @return array |
397 * @return array |
387 */ |
398 */ |
388 protected function get_bulk_actions() { |
399 protected function get_bulk_actions() { |
389 $actions = array(); |
400 $actions = array(); |
390 $post_type_obj = get_post_type_object( $this->screen->post_type ); |
401 $post_type_obj = get_post_type_object( $this->screen->post_type ); |
391 |
402 |
392 if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { |
403 if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { |
393 if ( $this->is_trash ) { |
404 if ( $this->is_trash ) { |
394 $actions['untrash'] = __( 'Restore' ); |
405 $actions['untrash'] = __( 'Restore' ); |
433 } |
444 } |
434 |
445 |
435 if ( is_object_in_taxonomy( $post_type, 'category' ) ) { |
446 if ( is_object_in_taxonomy( $post_type, 'category' ) ) { |
436 $dropdown_options = array( |
447 $dropdown_options = array( |
437 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, |
448 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, |
438 'hide_empty' => 0, |
449 'hide_empty' => 0, |
439 'hierarchical' => 1, |
450 'hierarchical' => 1, |
440 'show_count' => 0, |
451 'show_count' => 0, |
441 'orderby' => 'name', |
452 'orderby' => 'name', |
442 'selected' => $cat |
453 'selected' => $cat, |
443 ); |
454 ); |
444 |
455 |
445 echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>'; |
456 echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>'; |
446 wp_dropdown_categories( $dropdown_options ); |
457 wp_dropdown_categories( $dropdown_options ); |
447 } |
458 } |
448 } |
459 } |
449 |
460 |
450 /** |
461 /** |
462 * Displays a formats drop-down for filtering items. |
|
463 * |
|
464 * @since 5.2.0 |
|
465 * @access protected |
|
466 * |
|
467 * @param string $post_type Post type key. |
|
468 */ |
|
469 protected function formats_dropdown( $post_type ) { |
|
470 /** |
|
471 * Filters whether to remove the 'Formats' drop-down from the post list table. |
|
472 * |
|
473 * @since 5.2.0 |
|
474 * |
|
475 * @param bool $disable Whether to disable the drop-down. Default false. |
|
476 */ |
|
477 if ( apply_filters( 'disable_formats_dropdown', false ) ) { |
|
478 return; |
|
479 } |
|
480 |
|
481 // Make sure the dropdown shows only formats with a post count greater than 0. |
|
482 $used_post_formats = get_terms( |
|
483 array( |
|
484 'taxonomy' => 'post_format', |
|
485 'hide_empty' => true, |
|
486 ) |
|
487 ); |
|
488 |
|
489 /* |
|
490 * Return if the post type doesn't have post formats, or there are no posts using formats, |
|
491 * or if we're in the trash. |
|
492 */ |
|
493 if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || ! $used_post_formats || $this->is_trash ) { |
|
494 return; |
|
495 } |
|
496 |
|
497 $displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : ''; |
|
498 ?> |
|
499 <label for="filter-by-format" class="screen-reader-text"><?php _e( 'Filter by post format' ); ?></label> |
|
500 <select name="post_format" id="filter-by-format"> |
|
501 <option<?php selected( $displayed_post_format, '' ); ?> value=""><?php _e( 'All formats' ); ?></option> |
|
502 <?php |
|
503 foreach ( $used_post_formats as $used_post_format ) { |
|
504 // Post format slug. |
|
505 $slug = str_replace( 'post-format-', '', $used_post_format->slug ); |
|
506 // Pretty, translated version of the post format slug. |
|
507 $pretty_name = get_post_format_string( $slug ); |
|
508 // Skip the standard post format. |
|
509 if ( 'standard' === $slug ) { |
|
510 continue; |
|
511 } |
|
512 ?> |
|
513 <option<?php selected( $displayed_post_format, $slug ); ?> value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $pretty_name ); ?></option> |
|
514 <?php |
|
515 } |
|
516 ?> |
|
517 </select> |
|
518 <?php |
|
519 } |
|
520 |
|
521 /** |
|
451 * @param string $which |
522 * @param string $which |
452 */ |
523 */ |
453 protected function extra_tablenav( $which ) { |
524 protected function extra_tablenav( $which ) { |
454 ?> |
525 ?> |
455 <div class="alignleft actions"> |
526 <div class="alignleft actions"> |
456 <?php |
527 <?php |
457 if ( 'top' === $which && !is_singular() ) { |
528 if ( 'top' === $which && ! is_singular() ) { |
458 ob_start(); |
529 ob_start(); |
459 |
530 |
460 $this->months_dropdown( $this->screen->post_type ); |
531 $this->months_dropdown( $this->screen->post_type ); |
461 $this->categories_dropdown( $this->screen->post_type ); |
532 $this->categories_dropdown( $this->screen->post_type ); |
533 $this->formats_dropdown( $this->screen->post_type ); |
|
462 |
534 |
463 /** |
535 /** |
464 * Fires before the Filter button on the Posts and Pages list tables. |
536 * Fires before the Filter button on the Posts and Pages list tables. |
465 * |
537 * |
466 * The Filter button allows sorting by date and/or category on the |
538 * The Filter button allows sorting by date and/or category on the |
486 } |
558 } |
487 |
559 |
488 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) { |
560 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) { |
489 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); |
561 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); |
490 } |
562 } |
491 ?> |
563 ?> |
492 </div> |
564 </div> |
493 <?php |
565 <?php |
494 /** |
566 /** |
495 * Fires immediately following the closing "actions" div in the tablenav for the posts |
567 * Fires immediately following the closing "actions" div in the tablenav for the posts |
496 * list table. |
568 * list table. |
497 * |
569 * |
498 * @since 4.4.0 |
570 * @since 4.4.0 |
501 */ |
573 */ |
502 do_action( 'manage_posts_extra_tablenav', $which ); |
574 do_action( 'manage_posts_extra_tablenav', $which ); |
503 } |
575 } |
504 |
576 |
505 /** |
577 /** |
506 * |
|
507 * @return string |
578 * @return string |
508 */ |
579 */ |
509 public function current_action() { |
580 public function current_action() { |
510 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
581 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { |
511 return 'delete_all'; |
582 return 'delete_all'; |
583 } |
|
512 |
584 |
513 return parent::current_action(); |
585 return parent::current_action(); |
514 } |
586 } |
515 |
587 |
516 /** |
588 /** |
517 * |
|
518 * @return array |
589 * @return array |
519 */ |
590 */ |
520 protected function get_table_classes() { |
591 protected function get_table_classes() { |
521 return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' ); |
592 return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' ); |
522 } |
593 } |
523 |
594 |
524 /** |
595 /** |
525 * |
|
526 * @return array |
596 * @return array |
527 */ |
597 */ |
528 public function get_columns() { |
598 public function get_columns() { |
529 $post_type = $this->screen->post_type; |
599 $post_type = $this->screen->post_type; |
530 |
600 |
548 * The dynamic portion of the hook name, `$post_type`, refers to the post |
618 * The dynamic portion of the hook name, `$post_type`, refers to the post |
549 * type slug. |
619 * type slug. |
550 * |
620 * |
551 * @since 3.5.0 |
621 * @since 3.5.0 |
552 * |
622 * |
553 * @param array $taxonomies Array of taxonomies to show columns for. |
623 * @param string[] $taxonomies Array of taxonomy names to show columns for. |
554 * @param string $post_type The post type. |
624 * @param string $post_type The post type. |
555 */ |
625 */ |
556 $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); |
626 $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); |
557 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); |
627 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); |
558 |
628 |
559 foreach ( $taxonomies as $taxonomy ) { |
629 foreach ( $taxonomies as $taxonomy ) { |
560 if ( 'category' === $taxonomy ) |
630 if ( 'category' === $taxonomy ) { |
561 $column_key = 'categories'; |
631 $column_key = 'categories'; |
562 elseif ( 'post_tag' === $taxonomy ) |
632 } elseif ( 'post_tag' === $taxonomy ) { |
563 $column_key = 'tags'; |
633 $column_key = 'tags'; |
564 else |
634 } else { |
565 $column_key = 'taxonomy-' . $taxonomy; |
635 $column_key = 'taxonomy-' . $taxonomy; |
636 } |
|
566 |
637 |
567 $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; |
638 $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; |
568 } |
639 } |
569 |
640 |
570 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; |
641 $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; |
571 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) |
642 if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) { |
572 $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
643 $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
644 } |
|
573 |
645 |
574 $posts_columns['date'] = __( 'Date' ); |
646 $posts_columns['date'] = __( 'Date' ); |
575 |
647 |
576 if ( 'page' === $post_type ) { |
648 if ( 'page' === $post_type ) { |
577 |
649 |
578 /** |
650 /** |
579 * Filters the columns displayed in the Pages list table. |
651 * Filters the columns displayed in the Pages list table. |
580 * |
652 * |
581 * @since 2.5.0 |
653 * @since 2.5.0 |
582 * |
654 * |
583 * @param array $post_columns An array of column names. |
655 * @param string[] $post_columns An associative array of column headings. |
584 */ |
656 */ |
585 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); |
657 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); |
586 } else { |
658 } else { |
587 |
659 |
588 /** |
660 /** |
589 * Filters the columns displayed in the Posts list table. |
661 * Filters the columns displayed in the Posts list table. |
590 * |
662 * |
591 * @since 1.5.0 |
663 * @since 1.5.0 |
592 * |
664 * |
593 * @param array $posts_columns An array of column names. |
665 * @param string[] $post_columns An associative array of column headings. |
594 * @param string $post_type The post type slug. |
666 * @param string $post_type The post type slug. |
595 */ |
667 */ |
596 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); |
668 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); |
597 } |
669 } |
598 |
670 |
599 /** |
671 /** |
601 * |
673 * |
602 * The dynamic portion of the hook name, `$post_type`, refers to the post type slug. |
674 * The dynamic portion of the hook name, `$post_type`, refers to the post type slug. |
603 * |
675 * |
604 * @since 3.0.0 |
676 * @since 3.0.0 |
605 * |
677 * |
606 * @param array $post_columns An array of column names. |
678 * @param string[] $post_columns An associative array of column headings. |
607 */ |
679 */ |
608 return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); |
680 return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); |
609 } |
681 } |
610 |
682 |
611 /** |
683 /** |
612 * |
|
613 * @return array |
684 * @return array |
614 */ |
685 */ |
615 protected function get_sortable_columns() { |
686 protected function get_sortable_columns() { |
616 return array( |
687 return array( |
617 'title' => 'title', |
688 'title' => 'title', |
618 'parent' => 'parent', |
689 'parent' => 'parent', |
619 'comments' => 'comment_count', |
690 'comments' => 'comment_count', |
620 'date' => array( 'date', true ) |
691 'date' => array( 'date', true ), |
621 ); |
692 ); |
622 } |
693 } |
623 |
694 |
624 /** |
695 /** |
625 * @global WP_Query $wp_query |
696 * @global WP_Query $wp_query |
628 * @param int $level |
699 * @param int $level |
629 */ |
700 */ |
630 public function display_rows( $posts = array(), $level = 0 ) { |
701 public function display_rows( $posts = array(), $level = 0 ) { |
631 global $wp_query, $per_page; |
702 global $wp_query, $per_page; |
632 |
703 |
633 if ( empty( $posts ) ) |
704 if ( empty( $posts ) ) { |
634 $posts = $wp_query->posts; |
705 $posts = $wp_query->posts; |
706 } |
|
635 |
707 |
636 add_filter( 'the_title', 'esc_html' ); |
708 add_filter( 'the_title', 'esc_html' ); |
637 |
709 |
638 if ( $this->hierarchical_display ) { |
710 if ( $this->hierarchical_display ) { |
639 $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); |
711 $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); |
645 /** |
717 /** |
646 * @param array $posts |
718 * @param array $posts |
647 * @param int $level |
719 * @param int $level |
648 */ |
720 */ |
649 private function _display_rows( $posts, $level = 0 ) { |
721 private function _display_rows( $posts, $level = 0 ) { |
722 $post_type = $this->screen->post_type; |
|
723 |
|
650 // Create array of post IDs. |
724 // Create array of post IDs. |
651 $post_ids = array(); |
725 $post_ids = array(); |
652 |
726 |
653 foreach ( $posts as $a_post ) |
727 foreach ( $posts as $a_post ) { |
654 $post_ids[] = $a_post->ID; |
728 $post_ids[] = $a_post->ID; |
655 |
729 } |
656 $this->comment_pending_count = get_pending_comments_num( $post_ids ); |
730 |
657 |
731 if ( post_type_supports( $post_type, 'comments' ) ) { |
658 foreach ( $posts as $post ) |
732 $this->comment_pending_count = get_pending_comments_num( $post_ids ); |
733 } |
|
734 |
|
735 foreach ( $posts as $post ) { |
|
659 $this->single_row( $post, $level ); |
736 $this->single_row( $post, $level ); |
737 } |
|
660 } |
738 } |
661 |
739 |
662 /** |
740 /** |
663 * @global wpdb $wpdb |
741 * @global wpdb $wpdb |
664 * @global WP_Post $post |
742 * @global WP_Post $post |
672 $level = 0; |
750 $level = 0; |
673 |
751 |
674 if ( ! $pages ) { |
752 if ( ! $pages ) { |
675 $pages = get_pages( array( 'sort_column' => 'menu_order' ) ); |
753 $pages = get_pages( array( 'sort_column' => 'menu_order' ) ); |
676 |
754 |
677 if ( ! $pages ) |
755 if ( ! $pages ) { |
678 return; |
756 return; |
757 } |
|
679 } |
758 } |
680 |
759 |
681 /* |
760 /* |
682 * Arrange pages into two parts: top level pages and children_pages |
761 * Arrange pages into two parts: top level pages and children_pages |
683 * children_pages is two dimensional array, eg. |
762 * children_pages is two dimensional array, eg. |
686 * If searching, ignore hierarchy and treat everything as top level |
765 * If searching, ignore hierarchy and treat everything as top level |
687 */ |
766 */ |
688 if ( empty( $_REQUEST['s'] ) ) { |
767 if ( empty( $_REQUEST['s'] ) ) { |
689 |
768 |
690 $top_level_pages = array(); |
769 $top_level_pages = array(); |
691 $children_pages = array(); |
770 $children_pages = array(); |
692 |
771 |
693 foreach ( $pages as $page ) { |
772 foreach ( $pages as $page ) { |
694 |
773 |
695 // Catch and repair bad pages. |
774 // Catch and repair bad pages. |
696 if ( $page->post_parent == $page->ID ) { |
775 if ( $page->post_parent == $page->ID ) { |
697 $page->post_parent = 0; |
776 $page->post_parent = 0; |
698 $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); |
777 $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); |
699 clean_post_cache( $page ); |
778 clean_post_cache( $page ); |
700 } |
779 } |
701 |
780 |
702 if ( 0 == $page->post_parent ) |
781 if ( 0 == $page->post_parent ) { |
703 $top_level_pages[] = $page; |
782 $top_level_pages[] = $page; |
704 else |
783 } else { |
705 $children_pages[ $page->post_parent ][] = $page; |
784 $children_pages[ $page->post_parent ][] = $page; |
785 } |
|
706 } |
786 } |
707 |
787 |
708 $pages = &$top_level_pages; |
788 $pages = &$top_level_pages; |
709 } |
789 } |
710 |
790 |
711 $count = 0; |
791 $count = 0; |
712 $start = ( $pagenum - 1 ) * $per_page; |
792 $start = ( $pagenum - 1 ) * $per_page; |
713 $end = $start + $per_page; |
793 $end = $start + $per_page; |
714 $to_display = array(); |
794 $to_display = array(); |
715 |
795 |
716 foreach ( $pages as $page ) { |
796 foreach ( $pages as $page ) { |
717 if ( $count >= $end ) |
797 if ( $count >= $end ) { |
718 break; |
798 break; |
799 } |
|
719 |
800 |
720 if ( $count >= $start ) { |
801 if ( $count >= $start ) { |
721 $to_display[$page->ID] = $level; |
802 $to_display[ $page->ID ] = $level; |
722 } |
803 } |
723 |
804 |
724 $count++; |
805 $count++; |
725 |
806 |
726 if ( isset( $children_pages ) ) |
807 if ( isset( $children_pages ) ) { |
727 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); |
808 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); |
809 } |
|
728 } |
810 } |
729 |
811 |
730 // If it is the last pagenum and there are orphaned pages, display them with paging as well. |
812 // If it is the last pagenum and there are orphaned pages, display them with paging as well. |
731 if ( isset( $children_pages ) && $count < $end ){ |
813 if ( isset( $children_pages ) && $count < $end ) { |
732 foreach ( $children_pages as $orphans ){ |
814 foreach ( $children_pages as $orphans ) { |
733 foreach ( $orphans as $op ) { |
815 foreach ( $orphans as $op ) { |
734 if ( $count >= $end ) |
816 if ( $count >= $end ) { |
735 break; |
817 break; |
818 } |
|
736 |
819 |
737 if ( $count >= $start ) { |
820 if ( $count >= $start ) { |
738 $to_display[$op->ID] = 0; |
821 $to_display[ $op->ID ] = 0; |
739 } |
822 } |
740 |
823 |
741 $count++; |
824 $count++; |
742 } |
825 } |
743 } |
826 } |
770 * @param int $pagenum |
853 * @param int $pagenum |
771 * @param int $per_page |
854 * @param int $per_page |
772 * @param array $to_display List of pages to be displayed. Passed by reference. |
855 * @param array $to_display List of pages to be displayed. Passed by reference. |
773 */ |
856 */ |
774 private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page, &$to_display ) { |
857 private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page, &$to_display ) { |
775 if ( ! isset( $children_pages[$parent] ) ) |
858 if ( ! isset( $children_pages[ $parent ] ) ) { |
776 return; |
859 return; |
860 } |
|
777 |
861 |
778 $start = ( $pagenum - 1 ) * $per_page; |
862 $start = ( $pagenum - 1 ) * $per_page; |
779 $end = $start + $per_page; |
863 $end = $start + $per_page; |
780 |
864 |
781 foreach ( $children_pages[$parent] as $page ) { |
865 foreach ( $children_pages[ $parent ] as $page ) { |
782 if ( $count >= $end ) |
866 if ( $count >= $end ) { |
783 break; |
867 break; |
868 } |
|
784 |
869 |
785 // If the page starts in a subtree, print the parents. |
870 // If the page starts in a subtree, print the parents. |
786 if ( $count == $start && $page->post_parent > 0 ) { |
871 if ( $count == $start && $page->post_parent > 0 ) { |
787 $my_parents = array(); |
872 $my_parents = array(); |
788 $my_parent = $page->post_parent; |
873 $my_parent = $page->post_parent; |
789 while ( $my_parent ) { |
874 while ( $my_parent ) { |
790 // Get the ID from the list or the attribute if my_parent is an object |
875 // Get the ID from the list or the attribute if my_parent is an object |
791 $parent_id = $my_parent; |
876 $parent_id = $my_parent; |
792 if ( is_object( $my_parent ) ) { |
877 if ( is_object( $my_parent ) ) { |
793 $parent_id = $my_parent->ID; |
878 $parent_id = $my_parent->ID; |
794 } |
879 } |
795 |
880 |
796 $my_parent = get_post( $parent_id ); |
881 $my_parent = get_post( $parent_id ); |
797 $my_parents[] = $my_parent; |
882 $my_parents[] = $my_parent; |
798 if ( !$my_parent->post_parent ) |
883 if ( ! $my_parent->post_parent ) { |
799 break; |
884 break; |
885 } |
|
800 $my_parent = $my_parent->post_parent; |
886 $my_parent = $my_parent->post_parent; |
801 } |
887 } |
802 $num_parents = count( $my_parents ); |
888 $num_parents = count( $my_parents ); |
803 while ( $my_parent = array_pop( $my_parents ) ) { |
889 while ( $my_parent = array_pop( $my_parents ) ) { |
804 $to_display[$my_parent->ID] = $level - $num_parents; |
890 $to_display[ $my_parent->ID ] = $level - $num_parents; |
805 $num_parents--; |
891 $num_parents--; |
806 } |
892 } |
807 } |
893 } |
808 |
894 |
809 if ( $count >= $start ) { |
895 if ( $count >= $start ) { |
810 $to_display[$page->ID] = $level; |
896 $to_display[ $page->ID ] = $level; |
811 } |
897 } |
812 |
898 |
813 $count++; |
899 $count++; |
814 |
900 |
815 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); |
901 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); |
816 } |
902 } |
817 |
903 |
818 unset( $children_pages[$parent] ); //required in order to keep track of orphans |
904 unset( $children_pages[ $parent ] ); //required in order to keep track of orphans |
819 } |
905 } |
820 |
906 |
821 /** |
907 /** |
822 * Handles the checkbox column output. |
908 * Handles the checkbox column output. |
823 * |
909 * |
824 * @since 4.3.0 |
910 * @since 4.3.0 |
825 * |
911 * |
826 * @param WP_Post $post The current WP_Post object. |
912 * @param WP_Post $post The current WP_Post object. |
827 */ |
913 */ |
828 public function column_cb( $post ) { |
914 public function column_cb( $post ) { |
829 if ( current_user_can( 'edit_post', $post->ID ) ): ?> |
915 if ( current_user_can( 'edit_post', $post->ID ) ) : |
830 <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php |
916 ?> |
831 printf( __( 'Select %s' ), _draft_or_post_title() ); |
917 <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"> |
832 ?></label> |
918 <?php |
919 printf( __( 'Select %s' ), _draft_or_post_title() ); |
|
920 ?> |
|
921 </label> |
|
833 <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" /> |
922 <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" /> |
834 <div class="locked-indicator"> |
923 <div class="locked-indicator"> |
835 <span class="locked-indicator-icon" aria-hidden="true"></span> |
924 <span class="locked-indicator-icon" aria-hidden="true"></span> |
836 <span class="screen-reader-text"><?php |
925 <span class="screen-reader-text"> |
926 <?php |
|
837 printf( |
927 printf( |
838 /* translators: %s: post title */ |
928 /* translators: %s: post title */ |
839 __( '“%s” is locked' ), |
929 __( '“%s” is locked' ), |
840 _draft_or_post_title() |
930 _draft_or_post_title() |
841 ); |
931 ); |
842 ?></span> |
932 ?> |
933 </span> |
|
843 </div> |
934 </div> |
844 <?php endif; |
935 <?php |
936 endif; |
|
845 } |
937 } |
846 |
938 |
847 /** |
939 /** |
848 * @since 4.3.0 |
940 * @since 4.3.0 |
849 * |
941 * |
897 |
989 |
898 if ( $can_edit_post && $post->post_status != 'trash' ) { |
990 if ( $can_edit_post && $post->post_status != 'trash' ) { |
899 $lock_holder = wp_check_post_lock( $post->ID ); |
991 $lock_holder = wp_check_post_lock( $post->ID ); |
900 |
992 |
901 if ( $lock_holder ) { |
993 if ( $lock_holder ) { |
902 $lock_holder = get_userdata( $lock_holder ); |
994 $lock_holder = get_userdata( $lock_holder ); |
903 $locked_avatar = get_avatar( $lock_holder->ID, 18 ); |
995 $locked_avatar = get_avatar( $lock_holder->ID, 18 ); |
904 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); |
996 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); |
905 } else { |
997 } else { |
906 $locked_avatar = $locked_text = ''; |
998 $locked_avatar = $locked_text = ''; |
907 } |
999 } |
908 |
1000 |
909 echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; |
1001 echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; |
910 } |
1002 } |
911 |
1003 |
912 $pad = str_repeat( '— ', $this->current_level ); |
1004 $pad = str_repeat( '— ', $this->current_level ); |
913 echo "<strong>"; |
1005 echo '<strong>'; |
914 |
|
915 $format = get_post_format( $post->ID ); |
|
916 if ( $format ) { |
|
917 $label = get_post_format_string( $format ); |
|
918 |
|
919 $format_class = 'post-state-format post-format-icon post-format-' . $format; |
|
920 |
|
921 $format_args = array( |
|
922 'post_format' => $format, |
|
923 'post_type' => $post->post_type |
|
924 ); |
|
925 |
|
926 echo $this->get_edit_link( $format_args, $label . ':', $format_class ); |
|
927 } |
|
928 |
1006 |
929 $title = _draft_or_post_title(); |
1007 $title = _draft_or_post_title(); |
930 |
1008 |
931 if ( $can_edit_post && $post->post_status != 'trash' ) { |
1009 if ( $can_edit_post && $post->post_status != 'trash' ) { |
932 printf( |
1010 printf( |
936 esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), |
1014 esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), |
937 $pad, |
1015 $pad, |
938 $title |
1016 $title |
939 ); |
1017 ); |
940 } else { |
1018 } else { |
941 echo $pad . $title; |
1019 printf( |
1020 '<span>%s%s</span>', |
|
1021 $pad, |
|
1022 $title |
|
1023 ); |
|
942 } |
1024 } |
943 _post_states( $post ); |
1025 _post_states( $post ); |
944 |
1026 |
945 if ( isset( $parent_name ) ) { |
1027 if ( isset( $parent_name ) ) { |
946 $post_type_object = get_post_type_object( $post->post_type ); |
1028 $post_type_object = get_post_type_object( $post->post_type ); |
970 */ |
1052 */ |
971 public function column_date( $post ) { |
1053 public function column_date( $post ) { |
972 global $mode; |
1054 global $mode; |
973 |
1055 |
974 if ( '0000-00-00 00:00:00' === $post->post_date ) { |
1056 if ( '0000-00-00 00:00:00' === $post->post_date ) { |
975 $t_time = $h_time = __( 'Unpublished' ); |
1057 $t_time = $h_time = __( 'Unpublished' ); |
976 $time_diff = 0; |
1058 $time_diff = 0; |
977 } else { |
1059 } else { |
978 $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) ); |
1060 $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) ); |
979 $m_time = $post->post_date; |
1061 $m_time = $post->post_date; |
980 $time = get_post_time( 'G', true, $post ); |
1062 $time = get_post_time( 'G', true, $post ); |
981 |
1063 |
982 $time_diff = time() - $time; |
1064 $time_diff = time() - $time; |
983 |
1065 |
984 if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { |
1066 if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { |
985 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); |
1067 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); |
1048 */ |
1130 */ |
1049 public function column_comments( $post ) { |
1131 public function column_comments( $post ) { |
1050 ?> |
1132 ?> |
1051 <div class="post-com-count-wrapper"> |
1133 <div class="post-com-count-wrapper"> |
1052 <?php |
1134 <?php |
1053 $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0; |
1135 $pending_comments = isset( $this->comment_pending_count[ $post->ID ] ) ? $this->comment_pending_count[ $post->ID ] : 0; |
1054 |
1136 |
1055 $this->comments_bubble( $post->ID, $pending_comments ); |
1137 $this->comments_bubble( $post->ID, $pending_comments ); |
1056 ?> |
1138 ?> |
1057 </div> |
1139 </div> |
1058 <?php |
1140 <?php |
1066 * @param WP_Post $post The current WP_Post object. |
1148 * @param WP_Post $post The current WP_Post object. |
1067 */ |
1149 */ |
1068 public function column_author( $post ) { |
1150 public function column_author( $post ) { |
1069 $args = array( |
1151 $args = array( |
1070 'post_type' => $post->post_type, |
1152 'post_type' => $post->post_type, |
1071 'author' => get_the_author_meta( 'ID' ) |
1153 'author' => get_the_author_meta( 'ID' ), |
1072 ); |
1154 ); |
1073 echo $this->get_edit_link( $args, get_the_author() ); |
1155 echo $this->get_edit_link( $args, get_the_author() ); |
1074 } |
1156 } |
1075 |
1157 |
1076 /** |
1158 /** |
1091 } else { |
1173 } else { |
1092 $taxonomy = false; |
1174 $taxonomy = false; |
1093 } |
1175 } |
1094 if ( $taxonomy ) { |
1176 if ( $taxonomy ) { |
1095 $taxonomy_object = get_taxonomy( $taxonomy ); |
1177 $taxonomy_object = get_taxonomy( $taxonomy ); |
1096 $terms = get_the_terms( $post->ID, $taxonomy ); |
1178 $terms = get_the_terms( $post->ID, $taxonomy ); |
1097 if ( is_array( $terms ) ) { |
1179 if ( is_array( $terms ) ) { |
1098 $out = array(); |
1180 $term_links = array(); |
1099 foreach ( $terms as $t ) { |
1181 foreach ( $terms as $t ) { |
1100 $posts_in_term_qv = array(); |
1182 $posts_in_term_qv = array(); |
1101 if ( 'post' != $post->post_type ) { |
1183 if ( 'post' != $post->post_type ) { |
1102 $posts_in_term_qv['post_type'] = $post->post_type; |
1184 $posts_in_term_qv['post_type'] = $post->post_type; |
1103 } |
1185 } |
1104 if ( $taxonomy_object->query_var ) { |
1186 if ( $taxonomy_object->query_var ) { |
1105 $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug; |
1187 $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug; |
1106 } else { |
1188 } else { |
1107 $posts_in_term_qv['taxonomy'] = $taxonomy; |
1189 $posts_in_term_qv['taxonomy'] = $taxonomy; |
1108 $posts_in_term_qv['term'] = $t->slug; |
1190 $posts_in_term_qv['term'] = $t->slug; |
1109 } |
1191 } |
1110 |
1192 |
1111 $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); |
1193 $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); |
1112 $out[] = $this->get_edit_link( $posts_in_term_qv, $label ); |
1194 |
1195 $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label ); |
|
1113 } |
1196 } |
1197 |
|
1198 /** |
|
1199 * Filters the links in `$taxonomy` column of edit.php. |
|
1200 * |
|
1201 * @since 5.2.0 |
|
1202 * |
|
1203 * @param array $term_links List of links to edit.php, filtered by the taxonomy term. |
|
1204 * @param string $taxonomy Taxonomy name. |
|
1205 * @param array $terms Array of terms appearing in the post row. |
|
1206 */ |
|
1207 $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); |
|
1208 |
|
1114 /* translators: used between list items, there is a space after the comma */ |
1209 /* translators: used between list items, there is a space after the comma */ |
1115 echo join( __( ', ' ), $out ); |
1210 echo join( __( ', ' ), $term_links ); |
1116 } else { |
1211 } else { |
1117 echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>'; |
1212 echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>'; |
1118 } |
1213 } |
1119 return; |
1214 return; |
1120 } |
1215 } |
1169 * @param int $level |
1264 * @param int $level |
1170 */ |
1265 */ |
1171 public function single_row( $post, $level = 0 ) { |
1266 public function single_row( $post, $level = 0 ) { |
1172 $global_post = get_post(); |
1267 $global_post = get_post(); |
1173 |
1268 |
1174 $post = get_post( $post ); |
1269 $post = get_post( $post ); |
1175 $this->current_level = $level; |
1270 $this->current_level = $level; |
1176 |
1271 |
1177 $GLOBALS['post'] = $post; |
1272 $GLOBALS['post'] = $post; |
1178 setup_postdata( $post ); |
1273 setup_postdata( $post ); |
1179 |
1274 |
1183 if ( $lock_holder ) { |
1278 if ( $lock_holder ) { |
1184 $classes .= ' wp-locked'; |
1279 $classes .= ' wp-locked'; |
1185 } |
1280 } |
1186 |
1281 |
1187 if ( $post->post_parent ) { |
1282 if ( $post->post_parent ) { |
1188 $count = count( get_post_ancestors( $post->ID ) ); |
1283 $count = count( get_post_ancestors( $post->ID ) ); |
1189 $classes .= ' level-'. $count; |
1284 $classes .= ' level-' . $count; |
1190 } else { |
1285 } else { |
1191 $classes .= ' level-0'; |
1286 $classes .= ' level-0'; |
1192 } |
1287 } |
1193 ?> |
1288 ?> |
1194 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> |
1289 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> |
1195 <?php $this->single_row_columns( $post ); ?> |
1290 <?php $this->single_row_columns( $post ); ?> |
1196 </tr> |
1291 </tr> |
1197 <?php |
1292 <?php |
1198 $GLOBALS['post'] = $global_post; |
1293 $GLOBALS['post'] = $global_post; |
1199 } |
1294 } |
1200 |
1295 |
1201 /** |
1296 /** |
1202 * Gets the name of the default primary column. |
1297 * Gets the name of the default primary column. |
1223 if ( $primary !== $column_name ) { |
1318 if ( $primary !== $column_name ) { |
1224 return ''; |
1319 return ''; |
1225 } |
1320 } |
1226 |
1321 |
1227 $post_type_object = get_post_type_object( $post->post_type ); |
1322 $post_type_object = get_post_type_object( $post->post_type ); |
1228 $can_edit_post = current_user_can( 'edit_post', $post->ID ); |
1323 $can_edit_post = current_user_can( 'edit_post', $post->ID ); |
1229 $actions = array(); |
1324 $actions = array(); |
1230 $title = _draft_or_post_title(); |
1325 $title = _draft_or_post_title(); |
1231 |
1326 |
1232 if ( $can_edit_post && 'trash' != $post->post_status ) { |
1327 if ( $can_edit_post && 'trash' != $post->post_status ) { |
1233 $actions['edit'] = sprintf( |
1328 $actions['edit'] = sprintf( |
1234 '<a href="%s" aria-label="%s">%s</a>', |
1329 '<a href="%s" aria-label="%s">%s</a>', |
1235 get_edit_post_link( $post->ID ), |
1330 get_edit_post_link( $post->ID ), |
1236 /* translators: %s: post title */ |
1331 /* translators: %s: post title */ |
1237 esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), |
1332 esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), |
1238 __( 'Edit' ) |
1333 __( 'Edit' ) |
1239 ); |
1334 ); |
1240 $actions['inline hide-if-no-js'] = sprintf( |
1335 |
1241 '<a href="#" class="editinline" aria-label="%s">%s</a>', |
1336 if ( 'wp_block' !== $post->post_type ) { |
1242 /* translators: %s: post title */ |
1337 $actions['inline hide-if-no-js'] = sprintf( |
1243 esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), |
1338 '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>', |
1244 __( 'Quick Edit' ) |
1339 /* translators: %s: post title */ |
1245 ); |
1340 esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), |
1341 __( 'Quick Edit' ) |
|
1342 ); |
|
1343 } |
|
1246 } |
1344 } |
1247 |
1345 |
1248 if ( current_user_can( 'delete_post', $post->ID ) ) { |
1346 if ( current_user_can( 'delete_post', $post->ID ) ) { |
1249 if ( 'trash' === $post->post_status ) { |
1347 if ( 'trash' === $post->post_status ) { |
1250 $actions['untrash'] = sprintf( |
1348 $actions['untrash'] = sprintf( |
1275 } |
1373 } |
1276 |
1374 |
1277 if ( is_post_type_viewable( $post_type_object ) ) { |
1375 if ( is_post_type_viewable( $post_type_object ) ) { |
1278 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { |
1376 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { |
1279 if ( $can_edit_post ) { |
1377 if ( $can_edit_post ) { |
1280 $preview_link = get_preview_post_link( $post ); |
1378 $preview_link = get_preview_post_link( $post ); |
1281 $actions['view'] = sprintf( |
1379 $actions['view'] = sprintf( |
1282 '<a href="%s" rel="bookmark" aria-label="%s">%s</a>', |
1380 '<a href="%s" rel="bookmark" aria-label="%s">%s</a>', |
1283 esc_url( $preview_link ), |
1381 esc_url( $preview_link ), |
1284 /* translators: %s: post title */ |
1382 /* translators: %s: post title */ |
1285 esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), |
1383 esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), |
1295 __( 'View' ) |
1393 __( 'View' ) |
1296 ); |
1394 ); |
1297 } |
1395 } |
1298 } |
1396 } |
1299 |
1397 |
1398 if ( 'wp_block' === $post->post_type ) { |
|
1399 $actions['export'] = sprintf( |
|
1400 '<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>', |
|
1401 $post->ID, |
|
1402 /* translators: %s: post title */ |
|
1403 esc_attr( sprintf( __( 'Export “%s” as JSON' ), $title ) ), |
|
1404 __( 'Export as JSON' ) |
|
1405 ); |
|
1406 } |
|
1407 |
|
1300 if ( is_post_type_hierarchical( $post->post_type ) ) { |
1408 if ( is_post_type_hierarchical( $post->post_type ) ) { |
1301 |
1409 |
1302 /** |
1410 /** |
1303 * Filters the array of row action links on the Pages list table. |
1411 * Filters the array of row action links on the Pages list table. |
1304 * |
1412 * |
1305 * The filter is evaluated only for hierarchical post types. |
1413 * The filter is evaluated only for hierarchical post types. |
1306 * |
1414 * |
1307 * @since 2.8.0 |
1415 * @since 2.8.0 |
1308 * |
1416 * |
1309 * @param array $actions An array of row action links. Defaults are |
1417 * @param string[] $actions An array of row action links. Defaults are |
1310 * 'Edit', 'Quick Edit', 'Restore', 'Trash', |
1418 * 'Edit', 'Quick Edit', 'Restore', 'Trash', |
1311 * 'Delete Permanently', 'Preview', and 'View'. |
1419 * 'Delete Permanently', 'Preview', and 'View'. |
1312 * @param WP_Post $post The post object. |
1420 * @param WP_Post $post The post object. |
1313 */ |
1421 */ |
1314 $actions = apply_filters( 'page_row_actions', $actions, $post ); |
1422 $actions = apply_filters( 'page_row_actions', $actions, $post ); |
1315 } else { |
1423 } else { |
1316 |
1424 |
1317 /** |
1425 /** |
1319 * |
1427 * |
1320 * The filter is evaluated only for non-hierarchical post types. |
1428 * The filter is evaluated only for non-hierarchical post types. |
1321 * |
1429 * |
1322 * @since 2.8.0 |
1430 * @since 2.8.0 |
1323 * |
1431 * |
1324 * @param array $actions An array of row action links. Defaults are |
1432 * @param string[] $actions An array of row action links. Defaults are |
1325 * 'Edit', 'Quick Edit', 'Restore', 'Trash', |
1433 * 'Edit', 'Quick Edit', 'Restore', 'Trash', |
1326 * 'Delete Permanently', 'Preview', and 'View'. |
1434 * 'Delete Permanently', 'Preview', and 'View'. |
1327 * @param WP_Post $post The post object. |
1435 * @param WP_Post $post The post object. |
1328 */ |
1436 */ |
1329 $actions = apply_filters( 'post_row_actions', $actions, $post ); |
1437 $actions = apply_filters( 'post_row_actions', $actions, $post ); |
1330 } |
1438 } |
1331 |
1439 |
1332 return $this->row_actions( $actions ); |
1440 return $this->row_actions( $actions ); |
1342 public function inline_edit() { |
1450 public function inline_edit() { |
1343 global $mode; |
1451 global $mode; |
1344 |
1452 |
1345 $screen = $this->screen; |
1453 $screen = $this->screen; |
1346 |
1454 |
1347 $post = get_default_post_to_edit( $screen->post_type ); |
1455 $post = get_default_post_to_edit( $screen->post_type ); |
1348 $post_type_object = get_post_type_object( $screen->post_type ); |
1456 $post_type_object = get_post_type_object( $screen->post_type ); |
1349 |
1457 |
1350 $taxonomy_names = get_object_taxonomies( $screen->post_type ); |
1458 $taxonomy_names = get_object_taxonomies( $screen->post_type ); |
1351 $hierarchical_taxonomies = array(); |
1459 $hierarchical_taxonomies = array(); |
1352 $flat_taxonomies = array(); |
1460 $flat_taxonomies = array(); |
1353 foreach ( $taxonomy_names as $taxonomy_name ) { |
1461 foreach ( $taxonomy_names as $taxonomy_name ) { |
1354 |
1462 |
1355 $taxonomy = get_taxonomy( $taxonomy_name ); |
1463 $taxonomy = get_taxonomy( $taxonomy_name ); |
1356 |
1464 |
1357 $show_in_quick_edit = $taxonomy->show_in_quick_edit; |
1465 $show_in_quick_edit = $taxonomy->show_in_quick_edit; |
1367 */ |
1475 */ |
1368 if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) { |
1476 if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) { |
1369 continue; |
1477 continue; |
1370 } |
1478 } |
1371 |
1479 |
1372 if ( $taxonomy->hierarchical ) |
1480 if ( $taxonomy->hierarchical ) { |
1373 $hierarchical_taxonomies[] = $taxonomy; |
1481 $hierarchical_taxonomies[] = $taxonomy; |
1374 else |
1482 } else { |
1375 $flat_taxonomies[] = $taxonomy; |
1483 $flat_taxonomies[] = $taxonomy; |
1376 } |
1484 } |
1377 |
1485 } |
1378 $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; |
1486 |
1379 $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
1487 $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; |
1380 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); |
1488 $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
1381 |
1489 $core_columns = array( |
1382 ?> |
1490 'cb' => true, |
1491 'date' => true, |
|
1492 'title' => true, |
|
1493 'categories' => true, |
|
1494 'tags' => true, |
|
1495 'comments' => true, |
|
1496 'author' => true, |
|
1497 ); |
|
1498 |
|
1499 ?> |
|
1383 |
1500 |
1384 <form method="get"><table style="display: none"><tbody id="inlineedit"> |
1501 <form method="get"><table style="display: none"><tbody id="inlineedit"> |
1385 <?php |
1502 <?php |
1386 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page'; |
1503 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page'; |
1387 $inline_edit_classes = "inline-edit-row inline-edit-row-$hclass"; |
1504 $inline_edit_classes = "inline-edit-row inline-edit-row-$hclass"; |
1388 $bulk_edit_classes = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}"; |
1505 $bulk_edit_classes = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}"; |
1389 $quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; |
1506 $quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; |
1390 |
1507 |
1391 $bulk = 0; |
1508 $bulk = 0; |
1392 while ( $bulk < 2 ) { ?> |
1509 while ( $bulk < 2 ) { |
1393 |
1510 ?> |
1394 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $inline_edit_classes . ' '; |
1511 |
1395 echo $bulk ? $bulk_edit_classes : $quick_edit_classes; |
1512 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class=" |
1396 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> |
1513 <?php |
1514 echo $inline_edit_classes . ' '; |
|
1515 echo $bulk ? $bulk_edit_classes : $quick_edit_classes; |
|
1516 ?> |
|
1517 " style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> |
|
1397 |
1518 |
1398 <fieldset class="inline-edit-col-left"> |
1519 <fieldset class="inline-edit-col-left"> |
1399 <legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend> |
1520 <legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend> |
1400 <div class="inline-edit-col"> |
1521 <div class="inline-edit-col"> |
1401 <?php |
1522 <?php |
1402 |
1523 |
1403 if ( post_type_supports( $screen->post_type, 'title' ) ) : |
1524 if ( post_type_supports( $screen->post_type, 'title' ) ) : |
1404 if ( $bulk ) : ?> |
1525 if ( $bulk ) : |
1526 ?> |
|
1405 <div id="bulk-title-div"> |
1527 <div id="bulk-title-div"> |
1406 <div id="bulk-titles"></div> |
1528 <div id="bulk-titles"></div> |
1407 </div> |
1529 </div> |
1408 |
1530 |
1409 <?php else : // $bulk ?> |
1531 <?php else : // $bulk ?> |
1410 |
1532 |
1411 <label> |
1533 <label> |
1412 <span class="title"><?php _e( 'Title' ); ?></span> |
1534 <span class="title"><?php _e( 'Title' ); ?></span> |
1413 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> |
1535 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> |
1414 </label> |
1536 </label> |
1415 |
1537 |
1538 <?php if ( is_post_type_viewable( $screen->post_type ) ) : // is_post_type_viewable check ?> |
|
1539 |
|
1416 <label> |
1540 <label> |
1417 <span class="title"><?php _e( 'Slug' ); ?></span> |
1541 <span class="title"><?php _e( 'Slug' ); ?></span> |
1418 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> |
1542 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> |
1419 </label> |
1543 </label> |
1420 |
1544 |
1421 <?php endif; // $bulk |
1545 <?php |
1422 endif; // post_type_supports title ?> |
1546 endif; // is_post_type_viewable check |
1423 |
1547 endif; // $bulk |
1424 <?php if ( !$bulk ) : ?> |
1548 endif; // post_type_supports title |
1549 ?> |
|
1550 |
|
1551 <?php if ( ! $bulk ) : ?> |
|
1425 <fieldset class="inline-edit-date"> |
1552 <fieldset class="inline-edit-date"> |
1426 <legend><span class="title"><?php _e( 'Date' ); ?></span></legend> |
1553 <legend><span class="title"><?php _e( 'Date' ); ?></span></legend> |
1427 <?php touch_time( 1, 1, 0, 1 ); ?> |
1554 <?php touch_time( 1, 1, 0, 1 ); ?> |
1428 </fieldset> |
1555 </fieldset> |
1429 <br class="clear" /> |
1556 <br class="clear" /> |
1430 <?php endif; // $bulk |
1557 <?php |
1431 |
1558 endif; // $bulk |
1432 if ( post_type_supports( $screen->post_type, 'author' ) ) : |
1559 |
1433 $authors_dropdown = ''; |
1560 if ( post_type_supports( $screen->post_type, 'author' ) ) : |
1434 |
1561 $authors_dropdown = ''; |
1435 if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) : |
1562 |
1436 $users_opt = array( |
1563 if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) : |
1437 'hide_if_only_one_author' => false, |
1564 $users_opt = array( |
1438 'who' => 'authors', |
1565 'hide_if_only_one_author' => false, |
1439 'name' => 'post_author', |
1566 'who' => 'authors', |
1440 'class'=> 'authors', |
1567 'name' => 'post_author', |
1441 'multi' => 1, |
1568 'class' => 'authors', |
1442 'echo' => 0, |
1569 'multi' => 1, |
1443 'show' => 'display_name_with_login', |
1570 'echo' => 0, |
1444 ); |
1571 'show' => 'display_name_with_login', |
1445 if ( $bulk ) |
1572 ); |
1446 $users_opt['show_option_none'] = __( '— No Change —' ); |
1573 if ( $bulk ) { |
1447 |
1574 $users_opt['show_option_none'] = __( '— No Change —' ); |
1448 if ( $authors = wp_dropdown_users( $users_opt ) ) : |
1575 } |
1449 $authors_dropdown = '<label class="inline-edit-author">'; |
1576 |
1450 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; |
1577 if ( $authors = wp_dropdown_users( $users_opt ) ) : |
1451 $authors_dropdown .= $authors; |
1578 $authors_dropdown = '<label class="inline-edit-author">'; |
1452 $authors_dropdown .= '</label>'; |
1579 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; |
1453 endif; |
1580 $authors_dropdown .= $authors; |
1454 endif; // authors |
1581 $authors_dropdown .= '</label>'; |
1455 ?> |
1582 endif; |
1456 |
1583 endif; // authors |
1457 <?php if ( !$bulk ) echo $authors_dropdown; |
1584 ?> |
1585 |
|
1586 <?php |
|
1587 if ( ! $bulk ) { |
|
1588 echo $authors_dropdown;} |
|
1458 endif; // post_type_supports author |
1589 endif; // post_type_supports author |
1459 |
1590 |
1460 if ( !$bulk && $can_publish ) : |
1591 if ( ! $bulk && $can_publish ) : |
1461 ?> |
1592 ?> |
1462 |
1593 |
1463 <div class="inline-edit-group wp-clearfix"> |
1594 <div class="inline-edit-group wp-clearfix"> |
1464 <label class="alignleft"> |
1595 <label class="alignleft"> |
1465 <span class="title"><?php _e( 'Password' ); ?></span> |
1596 <span class="title"><?php _e( 'Password' ); ?></span> |
1466 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> |
1597 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> |
1467 </label> |
1598 </label> |
1468 |
1599 |
1469 <em class="alignleft inline-edit-or"> |
1600 <em class="alignleft inline-edit-or"> |
1470 <?php |
1601 <?php |
1471 /* translators: Between password field and private checkbox on post quick edit interface */ |
1602 /* translators: Between password field and private checkbox on post quick edit interface */ |
1472 _e( '–OR–' ); |
1603 _e( '–OR–' ); |
1473 ?> |
1604 ?> |
1474 </em> |
1605 </em> |
1475 <label class="alignleft inline-edit-private"> |
1606 <label class="alignleft inline-edit-private"> |
1476 <input type="checkbox" name="keep_private" value="private" /> |
1607 <input type="checkbox" name="keep_private" value="private" /> |
1477 <span class="checkbox-title"><?php _e( 'Private' ); ?></span> |
1608 <span class="checkbox-title"><?php _e( 'Private' ); ?></span> |
1478 </label> |
1609 </label> |
1479 </div> |
1610 </div> |
1480 |
1611 |
1481 <?php endif; ?> |
1612 <?php endif; ?> |
1482 |
1613 |
1483 </div></fieldset> |
1614 </div></fieldset> |
1484 |
1615 |
1485 <?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?> |
1616 <?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?> |
1486 |
1617 |
1487 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> |
1618 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> |
1488 |
1619 |
1489 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> |
1620 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> |
1490 |
1621 |
1491 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span> |
1622 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span> |
1492 <input type="hidden" name="<?php echo ( $taxonomy->name === 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> |
1623 <input type="hidden" name="<?php echo ( $taxonomy->name === 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> |
1493 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist"> |
1624 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist"> |
1494 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?> |
1625 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?> |
1495 </ul> |
1626 </ul> |
1496 |
1627 |
1497 <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?> |
1628 <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?> |
1498 |
1629 |
1499 </div></fieldset> |
1630 </div></fieldset> |
1500 |
1631 |
1501 <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?> |
1632 <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?> |
1502 |
1633 |
1503 <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> |
1634 <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> |
1504 |
1635 |
1505 <?php |
1636 <?php |
1506 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) |
1637 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) { |
1507 echo $authors_dropdown; |
1638 echo $authors_dropdown; |
1508 |
1639 } |
1509 if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : |
1640 |
1510 |
1641 if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : |
1511 if ( $post_type_object->hierarchical ) : |
1642 |
1512 ?> |
1643 if ( $post_type_object->hierarchical ) : |
1513 <label> |
1644 ?> |
1514 <span class="title"><?php _e( 'Parent' ); ?></span> |
1645 <label> |
1515 <?php |
1646 <span class="title"><?php _e( 'Parent' ); ?></span> |
1516 $dropdown_args = array( |
1647 <?php |
1517 'post_type' => $post_type_object->name, |
1648 $dropdown_args = array( |
1518 'selected' => $post->post_parent, |
1649 'post_type' => $post_type_object->name, |
1519 'name' => 'post_parent', |
1650 'selected' => $post->post_parent, |
1520 'show_option_none' => __( 'Main Page (no parent)' ), |
1651 'name' => 'post_parent', |
1521 'option_none_value' => 0, |
1652 'show_option_none' => __( 'Main Page (no parent)' ), |
1522 'sort_column' => 'menu_order, post_title', |
1653 'option_none_value' => 0, |
1523 ); |
1654 'sort_column' => 'menu_order, post_title', |
1524 |
1655 ); |
1525 if ( $bulk ) |
1656 |
1526 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); |
1657 if ( $bulk ) { |
1527 |
1658 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); |
1528 /** |
1659 } |
1529 * Filters the arguments used to generate the Quick Edit page-parent drop-down. |
1660 |
1530 * |
1661 /** |
1531 * @since 2.7.0 |
1662 * Filters the arguments used to generate the Quick Edit page-parent drop-down. |
1532 * |
1663 * |
1533 * @see wp_dropdown_pages() |
1664 * @since 2.7.0 |
1534 * |
1665 * |
1535 * @param array $dropdown_args An array of arguments. |
1666 * @see wp_dropdown_pages() |
1536 */ |
1667 * |
1537 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args ); |
1668 * @param array $dropdown_args An array of arguments. |
1538 |
1669 */ |
1539 wp_dropdown_pages( $dropdown_args ); |
1670 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args ); |
1540 ?> |
1671 |
1541 </label> |
1672 wp_dropdown_pages( $dropdown_args ); |
1542 |
1673 ?> |
1543 <?php |
1674 </label> |
1544 endif; // hierarchical |
1675 |
1545 |
1676 <?php |
1546 if ( !$bulk ) : ?> |
1677 endif; // hierarchical |
1678 |
|
1679 if ( ! $bulk ) : |
|
1680 ?> |
|
1547 |
1681 |
1548 <label> |
1682 <label> |
1549 <span class="title"><?php _e( 'Order' ); ?></span> |
1683 <span class="title"><?php _e( 'Order' ); ?></span> |
1550 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span> |
1684 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span> |
1551 </label> |
1685 </label> |
1552 |
1686 |
1553 <?php |
1687 <?php |
1554 endif; // !$bulk |
1688 endif; // !$bulk |
1555 endif; // page-attributes |
1689 endif; // page-attributes |
1556 ?> |
1690 ?> |
1557 |
1691 |
1558 <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?> |
1692 <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?> |
1559 <label> |
1693 <label> |
1560 <span class="title"><?php _e( 'Template' ); ?></span> |
1694 <span class="title"><?php _e( 'Template' ); ?></span> |
1561 <select name="page_template"> |
1695 <select name="page_template"> |
1562 <?php if ( $bulk ) : ?> |
1696 <?php if ( $bulk ) : ?> |
1563 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1697 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1564 <?php endif; // $bulk ?> |
1698 <?php endif; // $bulk ?> |
1565 <?php |
1699 <?php |
1566 /** This filter is documented in wp-admin/includes/meta-boxes.php */ |
1700 /** This filter is documented in wp-admin/includes/meta-boxes.php */ |
1567 $default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' ); |
1701 $default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' ); |
1568 ?> |
1702 ?> |
1569 <option value="default"><?php echo esc_html( $default_title ); ?></option> |
1703 <option value="default"><?php echo esc_html( $default_title ); ?></option> |
1570 <?php page_template_dropdown( '', $screen->post_type ) ?> |
1704 <?php page_template_dropdown( '', $screen->post_type ); ?> |
1571 </select> |
1705 </select> |
1572 </label> |
1706 </label> |
1573 <?php endif; ?> |
1707 <?php endif; ?> |
1574 |
1708 |
1575 <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?> |
1709 <?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?> |
1576 |
1710 |
1577 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?> |
1711 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?> |
1578 <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : |
1712 <?php |
1579 $taxonomy_name = esc_attr( $taxonomy->name ); |
1713 if ( current_user_can( $taxonomy->cap->assign_terms ) ) : |
1580 |
1714 $taxonomy_name = esc_attr( $taxonomy->name ); |
1581 ?> |
1715 |
1716 ?> |
|
1582 <label class="inline-edit-tags"> |
1717 <label class="inline-edit-tags"> |
1583 <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span> |
1718 <span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span> |
1584 <textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea> |
1719 <textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea> |
1585 </label> |
1720 </label> |
1586 <?php endif; ?> |
1721 <?php endif; ?> |
1587 |
1722 |
1588 <?php endforeach; //$flat_taxonomies as $taxonomy ?> |
1723 <?php endforeach; //$flat_taxonomies as $taxonomy ?> |
1589 |
1724 |
1590 <?php endif; // count( $flat_taxonomies ) && !$bulk ?> |
1725 <?php endif; // count( $flat_taxonomies ) && !$bulk ?> |
1591 |
1726 |
1592 <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : |
1727 <?php |
1593 if ( $bulk ) : ?> |
1728 if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : |
1729 if ( $bulk ) : |
|
1730 ?> |
|
1594 |
1731 |
1595 <div class="inline-edit-group wp-clearfix"> |
1732 <div class="inline-edit-group wp-clearfix"> |
1596 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> |
1733 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> |
1597 <label class="alignleft"> |
1734 <label class="alignleft"> |
1598 <span class="title"><?php _e( 'Comments' ); ?></span> |
1735 <span class="title"><?php _e( 'Comments' ); ?></span> |
1599 <select name="comment_status"> |
1736 <select name="comment_status"> |
1600 <option value=""><?php _e( '— No Change —' ); ?></option> |
1737 <option value=""><?php _e( '— No Change —' ); ?></option> |
1601 <option value="open"><?php _e( 'Allow' ); ?></option> |
1738 <option value="open"><?php _e( 'Allow' ); ?></option> |
1612 </select> |
1749 </select> |
1613 </label> |
1750 </label> |
1614 <?php endif; ?> |
1751 <?php endif; ?> |
1615 </div> |
1752 </div> |
1616 |
1753 |
1617 <?php else : // $bulk ?> |
1754 <?php else : // $bulk ?> |
1618 |
1755 |
1619 <div class="inline-edit-group wp-clearfix"> |
1756 <div class="inline-edit-group wp-clearfix"> |
1620 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> |
1757 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> |
1621 <label class="alignleft"> |
1758 <label class="alignleft"> |
1622 <input type="checkbox" name="comment_status" value="open" /> |
1759 <input type="checkbox" name="comment_status" value="open" /> |
1623 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span> |
1760 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span> |
1624 </label> |
1761 </label> |
1625 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> |
1762 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> |
1628 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span> |
1765 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span> |
1629 </label> |
1766 </label> |
1630 <?php endif; ?> |
1767 <?php endif; ?> |
1631 </div> |
1768 </div> |
1632 |
1769 |
1633 <?php endif; // $bulk |
1770 <?php |
1634 endif; // post_type_supports comments or pings ?> |
1771 endif; // $bulk |
1772 endif; // post_type_supports comments or pings |
|
1773 ?> |
|
1635 |
1774 |
1636 <div class="inline-edit-group wp-clearfix"> |
1775 <div class="inline-edit-group wp-clearfix"> |
1637 <label class="inline-edit-status alignleft"> |
1776 <label class="inline-edit-status alignleft"> |
1638 <span class="title"><?php _e( 'Status' ); ?></span> |
1777 <span class="title"><?php _e( 'Status' ); ?></span> |
1639 <select name="_status"> |
1778 <select name="_status"> |
1640 <?php if ( $bulk ) : ?> |
1779 <?php if ( $bulk ) : ?> |
1641 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1780 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1642 <?php endif; // $bulk ?> |
1781 <?php endif; // $bulk ?> |
1643 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?> |
1782 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?> |
1644 <option value="publish"><?php _e( 'Published' ); ?></option> |
1783 <option value="publish"><?php _e( 'Published' ); ?></option> |
1645 <option value="future"><?php _e( 'Scheduled' ); ?></option> |
1784 <option value="future"><?php _e( 'Scheduled' ); ?></option> |
1646 <?php if ( $bulk ) : ?> |
1785 <?php if ( $bulk ) : ?> |
1647 <option value="private"><?php _e( 'Private' ) ?></option> |
1786 <option value="private"><?php _e( 'Private' ); ?></option> |
1648 <?php endif; // $bulk ?> |
1787 <?php endif; // $bulk ?> |
1649 <?php endif; ?> |
1788 <?php endif; ?> |
1650 <option value="pending"><?php _e( 'Pending Review' ); ?></option> |
1789 <option value="pending"><?php _e( 'Pending Review' ); ?></option> |
1651 <option value="draft"><?php _e( 'Draft' ); ?></option> |
1790 <option value="draft"><?php _e( 'Draft' ); ?></option> |
1652 </select> |
1791 </select> |
1653 </label> |
1792 </label> |
1654 |
1793 |
1655 <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> |
1794 <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> |
1656 |
1795 |
1657 <?php if ( $bulk ) : ?> |
1796 <?php if ( $bulk ) : ?> |
1658 |
1797 |
1659 <label class="alignright"> |
1798 <label class="alignright"> |
1660 <span class="title"><?php _e( 'Sticky' ); ?></span> |
1799 <span class="title"><?php _e( 'Sticky' ); ?></span> |
1661 <select name="sticky"> |
1800 <select name="sticky"> |
1662 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1801 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1676 |
1815 |
1677 <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?> |
1816 <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?> |
1678 |
1817 |
1679 </div> |
1818 </div> |
1680 |
1819 |
1681 <?php |
1820 <?php |
1682 |
1821 |
1683 if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) { |
1822 if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) { |
1684 $post_formats = get_theme_support( 'post-formats' ); |
1823 $post_formats = get_theme_support( 'post-formats' ); |
1685 |
1824 |
1686 ?> |
1825 ?> |
1687 <label class="alignleft"> |
1826 <label class="alignleft"> |
1688 <span class="title"><?php _ex( 'Format', 'post format' ); ?></span> |
1827 <span class="title"><?php _ex( 'Format', 'post format' ); ?></span> |
1689 <select name="post_format"> |
1828 <select name="post_format"> |
1690 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1829 <option value="-1"><?php _e( '— No Change —' ); ?></option> |
1691 <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> |
1830 <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> |
1831 <?php |
|
1832 if ( is_array( $post_formats[0] ) ) { |
|
1833 foreach ( $post_formats[0] as $format ) { |
|
1834 ?> |
|
1835 <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option> |
|
1836 <?php |
|
1837 } |
|
1838 } |
|
1839 ?> |
|
1840 </select></label> |
|
1841 <?php |
|
1842 |
|
1843 } |
|
1844 |
|
1845 ?> |
|
1846 |
|
1847 </div></fieldset> |
|
1848 |
|
1692 <?php |
1849 <?php |
1693 if ( is_array( $post_formats[0] ) ) { |
1850 list( $columns ) = $this->get_column_info(); |
1694 foreach ( $post_formats[0] as $format ) { |
1851 |
1695 ?> |
1852 foreach ( $columns as $column_name => $column_display_name ) { |
1696 <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option> |
1853 if ( isset( $core_columns[ $column_name ] ) ) { |
1697 <?php |
1854 continue; |
1698 } |
1855 } |
1856 |
|
1857 if ( $bulk ) { |
|
1858 |
|
1859 /** |
|
1860 * Fires once for each column in Bulk Edit mode. |
|
1861 * |
|
1862 * @since 2.7.0 |
|
1863 * |
|
1864 * @param string $column_name Name of the column to edit. |
|
1865 * @param WP_Post $post_type The post type slug. |
|
1866 */ |
|
1867 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type ); |
|
1868 } else { |
|
1869 |
|
1870 /** |
|
1871 * Fires once for each column in Quick Edit mode. |
|
1872 * |
|
1873 * @since 2.7.0 |
|
1874 * |
|
1875 * @param string $column_name Name of the column to edit. |
|
1876 * @param string $post_type The post type slug, or current screen name if this is a taxonomy list table. |
|
1877 * @param string taxonomy The taxonomy name, if any. |
|
1878 */ |
|
1879 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' ); |
|
1880 } |
|
1699 } |
1881 } |
1700 ?> |
1882 ?> |
1701 </select></label> |
|
1702 <?php |
|
1703 |
|
1704 } |
|
1705 |
|
1706 ?> |
|
1707 |
|
1708 </div></fieldset> |
|
1709 |
|
1710 <?php |
|
1711 list( $columns ) = $this->get_column_info(); |
|
1712 |
|
1713 foreach ( $columns as $column_name => $column_display_name ) { |
|
1714 if ( isset( $core_columns[$column_name] ) ) |
|
1715 continue; |
|
1716 |
|
1717 if ( $bulk ) { |
|
1718 |
|
1719 /** |
|
1720 * Fires once for each column in Bulk Edit mode. |
|
1721 * |
|
1722 * @since 2.7.0 |
|
1723 * |
|
1724 * @param string $column_name Name of the column to edit. |
|
1725 * @param WP_Post $post_type The post type slug. |
|
1726 */ |
|
1727 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type ); |
|
1728 } else { |
|
1729 |
|
1730 /** |
|
1731 * Fires once for each column in Quick Edit mode. |
|
1732 * |
|
1733 * @since 2.7.0 |
|
1734 * |
|
1735 * @param string $column_name Name of the column to edit. |
|
1736 * @param string $post_type The post type slug, or current screen name if this is a taxonomy list table. |
|
1737 * @param string taxonomy The taxonomy name, if any. |
|
1738 */ |
|
1739 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' ); |
|
1740 } |
|
1741 |
|
1742 } |
|
1743 ?> |
|
1744 <div class="submit inline-edit-save"> |
1883 <div class="submit inline-edit-save"> |
1745 <button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button> |
1884 <button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button> |
1746 <?php if ( ! $bulk ) { |
1885 <?php |
1886 if ( ! $bulk ) { |
|
1747 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); |
1887 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); |
1748 ?> |
1888 ?> |
1749 <button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button> |
1889 <button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button> |
1750 <span class="spinner"></span> |
1890 <span class="spinner"></span> |
1751 <?php } else { |
1891 <?php |
1892 } else { |
|
1752 submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); |
1893 submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); |
1753 } ?> |
1894 } |
1895 ?> |
|
1754 <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" /> |
1896 <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" /> |
1755 <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" /> |
1897 <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" /> |
1756 <?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?> |
1898 <?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?> |
1757 <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
1899 <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
1758 <?php } ?> |
1900 <?php } ?> |
1760 <div class="notice notice-error notice-alt inline hidden"> |
1902 <div class="notice notice-error notice-alt inline hidden"> |
1761 <p class="error"></p> |
1903 <p class="error"></p> |
1762 </div> |
1904 </div> |
1763 </div> |
1905 </div> |
1764 </td></tr> |
1906 </td></tr> |
1765 <?php |
1907 <?php |
1766 $bulk++; |
1908 $bulk++; |
1767 } |
1909 } |
1768 ?> |
1910 ?> |
1769 </tbody></table></form> |
1911 </tbody></table></form> |
1770 <?php |
1912 <?php |
1771 } |
1913 } |
1772 } |
1914 } |