[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * List Table API: WP_Posts_List_Table class 4 * 5 * @package WordPress 6 * @subpackage Administration 7 * @since 3.1.0 8 */ 9 10 /** 11 * Core class used to implement displaying posts in a list table. 12 * 13 * @since 3.1.0 14 * 15 * @see WP_List_Table 16 */ 17 class WP_Posts_List_Table extends WP_List_Table { 18 19 /** 20 * Whether the items should be displayed hierarchically or linearly. 21 * 22 * @since 3.1.0 23 * @var bool 24 */ 25 protected $hierarchical_display; 26 27 /** 28 * Holds the number of pending comments for each post. 29 * 30 * @since 3.1.0 31 * @var array 32 */ 33 protected $comment_pending_count; 34 35 /** 36 * Holds the number of posts for this user. 37 * 38 * @since 3.1.0 39 * @var int 40 */ 41 private $user_posts_count; 42 43 /** 44 * Holds the number of posts which are sticky. 45 * 46 * @since 3.1.0 47 * @var int 48 */ 49 private $sticky_posts_count = 0; 50 51 private $is_trash; 52 53 /** 54 * Current level for output. 55 * 56 * @since 4.3.0 57 * @var int 58 */ 59 protected $current_level = 0; 60 61 /** 62 * Constructor. 63 * 64 * @since 3.1.0 65 * 66 * @see WP_List_Table::__construct() for more information on default arguments. 67 * 68 * @global WP_Post_Type $post_type_object 69 * @global wpdb $wpdb WordPress database abstraction object. 70 * 71 * @param array $args An associative array of arguments. 72 */ 73 public function __construct( $args = array() ) { 74 global $post_type_object, $wpdb; 75 76 parent::__construct( 77 array( 78 'plural' => 'posts', 79 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 80 ) 81 ); 82 83 $post_type = $this->screen->post_type; 84 $post_type_object = get_post_type_object( $post_type ); 85 86 $exclude_states = get_post_stati( 87 array( 88 'show_in_admin_all_list' => false, 89 ) 90 ); 91 92 $this->user_posts_count = (int) $wpdb->get_var( 93 $wpdb->prepare( 94 "SELECT COUNT( 1 ) 95 FROM $wpdb->posts 96 WHERE post_type = %s 97 AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) 98 AND post_author = %d", 99 $post_type, 100 get_current_user_id() 101 ) 102 ); 103 104 if ( $this->user_posts_count 105 && ! current_user_can( $post_type_object->cap->edit_others_posts ) 106 && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) 107 && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) 108 ) { 109 $_GET['author'] = get_current_user_id(); 110 } 111 112 $sticky_posts = get_option( 'sticky_posts' ); 113 114 if ( 'post' === $post_type && $sticky_posts ) { 115 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); 116 117 $this->sticky_posts_count = (int) $wpdb->get_var( 118 $wpdb->prepare( 119 "SELECT COUNT( 1 ) 120 FROM $wpdb->posts 121 WHERE post_type = %s 122 AND post_status NOT IN ('trash', 'auto-draft') 123 AND ID IN ($sticky_posts)", 124 $post_type 125 ) 126 ); 127 } 128 } 129 130 /** 131 * Sets whether the table layout should be hierarchical or not. 132 * 133 * @since 4.2.0 134 * 135 * @param bool $display Whether the table layout should be hierarchical. 136 */ 137 public function set_hierarchical_display( $display ) { 138 $this->hierarchical_display = $display; 139 } 140 141 /** 142 * @return bool 143 */ 144 public function ajax_user_can() { 145 return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); 146 } 147 148 /** 149 * @global string $mode List table view mode. 150 * @global array $avail_post_stati 151 * @global WP_Query $wp_query WordPress Query object. 152 * @global int $per_page 153 */ 154 public function prepare_items() { 155 global $mode, $avail_post_stati, $wp_query, $per_page; 156 157 if ( ! empty( $_REQUEST['mode'] ) ) { 158 $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; 159 set_user_setting( 'posts_list_mode', $mode ); 160 } else { 161 $mode = get_user_setting( 'posts_list_mode', 'list' ); 162 } 163 164 // Is going to call wp(). 165 $avail_post_stati = wp_edit_posts_query(); 166 167 $this->set_hierarchical_display( 168 is_post_type_hierarchical( $this->screen->post_type ) 169 && 'menu_order title' === $wp_query->query['orderby'] 170 ); 171 172 $post_type = $this->screen->post_type; 173 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); 174 175 /** This filter is documented in wp-admin/includes/post.php */ 176 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 177 178 if ( $this->hierarchical_display ) { 179 $total_items = $wp_query->post_count; 180 } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { 181 $total_items = $wp_query->found_posts; 182 } else { 183 $post_counts = (array) wp_count_posts( $post_type, 'readable' ); 184 185 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) { 186 $total_items = $post_counts[ $_REQUEST['post_status'] ]; 187 } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { 188 $total_items = $this->sticky_posts_count; 189 } elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) { 190 $total_items = $this->user_posts_count; 191 } else { 192 $total_items = array_sum( $post_counts ); 193 194 // Subtract post types that are not included in the admin all list. 195 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { 196 $total_items -= $post_counts[ $state ]; 197 } 198 } 199 } 200 201 $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status']; 202 203 $this->set_pagination_args( 204 array( 205 'total_items' => $total_items, 206 'per_page' => $per_page, 207 ) 208 ); 209 } 210 211 /** 212 * @return bool 213 */ 214 public function has_items() { 215 return have_posts(); 216 } 217 218 /** 219 */ 220 public function no_items() { 221 if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { 222 echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; 223 } else { 224 echo get_post_type_object( $this->screen->post_type )->labels->not_found; 225 } 226 } 227 228 /** 229 * Determines if the current view is the "All" view. 230 * 231 * @since 4.2.0 232 * 233 * @return bool Whether the current view is the "All" view. 234 */ 235 protected function is_base_request() { 236 $vars = $_GET; 237 unset( $vars['paged'] ); 238 239 if ( empty( $vars ) ) { 240 return true; 241 } elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) { 242 return $this->screen->post_type === $vars['post_type']; 243 } 244 245 return 1 === count( $vars ) && ! empty( $vars['mode'] ); 246 } 247 248 /** 249 * Creates a link to edit.php with params. 250 * 251 * @since 4.4.0 252 * 253 * @param string[] $args Associative array of URL parameters for the link. 254 * @param string $link_text Link text. 255 * @param string $css_class Optional. Class attribute. Default empty string. 256 * @return string The formatted link string. 257 */ 258 protected function get_edit_link( $args, $link_text, $css_class = '' ) { 259 $url = add_query_arg( $args, 'edit.php' ); 260 261 $class_html = ''; 262 $aria_current = ''; 263 264 if ( ! empty( $css_class ) ) { 265 $class_html = sprintf( 266 ' class="%s"', 267 esc_attr( $css_class ) 268 ); 269 270 if ( 'current' === $css_class ) { 271 $aria_current = ' aria-current="page"'; 272 } 273 } 274 275 return sprintf( 276 '<a href="%s"%s%s>%s</a>', 277 esc_url( $url ), 278 $class_html, 279 $aria_current, 280 $link_text 281 ); 282 } 283 284 /** 285 * @global array $locked_post_status This seems to be deprecated. 286 * @global array $avail_post_stati 287 * @return array 288 */ 289 protected function get_views() { 290 global $locked_post_status, $avail_post_stati; 291 292 $post_type = $this->screen->post_type; 293 294 if ( ! empty( $locked_post_status ) ) { 295 return array(); 296 } 297 298 $status_links = array(); 299 $num_posts = wp_count_posts( $post_type, 'readable' ); 300 $total_posts = array_sum( (array) $num_posts ); 301 $class = ''; 302 303 $current_user_id = get_current_user_id(); 304 $all_args = array( 'post_type' => $post_type ); 305 $mine = ''; 306 307 // Subtract post types that are not included in the admin all list. 308 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { 309 $total_posts -= $num_posts->$state; 310 } 311 312 if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) { 313 if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) { 314 $class = 'current'; 315 } 316 317 $mine_args = array( 318 'post_type' => $post_type, 319 'author' => $current_user_id, 320 ); 321 322 $mine_inner_html = sprintf( 323 /* translators: %s: Number of posts. */ 324 _nx( 325 'Mine <span class="count">(%s)</span>', 326 'Mine <span class="count">(%s)</span>', 327 $this->user_posts_count, 328 'posts' 329 ), 330 number_format_i18n( $this->user_posts_count ) 331 ); 332 333 $mine = array( 334 'url' => esc_url( add_query_arg( $mine_args, 'edit.php' ) ), 335 'label' => $mine_inner_html, 336 'current' => isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ), 337 ); 338 339 $all_args['all_posts'] = 1; 340 $class = ''; 341 } 342 343 $all_inner_html = sprintf( 344 /* translators: %s: Number of posts. */ 345 _nx( 346 'All <span class="count">(%s)</span>', 347 'All <span class="count">(%s)</span>', 348 $total_posts, 349 'posts' 350 ), 351 number_format_i18n( $total_posts ) 352 ); 353 354 $status_links['all'] = array( 355 'url' => esc_url( add_query_arg( $all_args, 'edit.php' ) ), 356 'label' => $all_inner_html, 357 'current' => empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ), 358 ); 359 360 if ( $mine ) { 361 $status_links['mine'] = $mine; 362 } 363 364 foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) { 365 $class = ''; 366 367 $status_name = $status->name; 368 369 if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) { 370 continue; 371 } 372 373 if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) { 374 $class = 'current'; 375 } 376 377 $status_args = array( 378 'post_status' => $status_name, 379 'post_type' => $post_type, 380 ); 381 382 $status_label = sprintf( 383 translate_nooped_plural( $status->label_count, $num_posts->$status_name ), 384 number_format_i18n( $num_posts->$status_name ) 385 ); 386 387 $status_links[ $status_name ] = array( 388 'url' => esc_url( add_query_arg( $status_args, 'edit.php' ) ), 389 'label' => $status_label, 390 'current' => isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'], 391 ); 392 } 393 394 if ( ! empty( $this->sticky_posts_count ) ) { 395 $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : ''; 396 397 $sticky_args = array( 398 'post_type' => $post_type, 399 'show_sticky' => 1, 400 ); 401 402 $sticky_inner_html = sprintf( 403 /* translators: %s: Number of posts. */ 404 _nx( 405 'Sticky <span class="count">(%s)</span>', 406 'Sticky <span class="count">(%s)</span>', 407 $this->sticky_posts_count, 408 'posts' 409 ), 410 number_format_i18n( $this->sticky_posts_count ) 411 ); 412 413 $sticky_link = array( 414 'sticky' => array( 415 'url' => esc_url( add_query_arg( $sticky_args, 'edit.php' ) ), 416 'label' => $sticky_inner_html, 417 'current' => ! empty( $_REQUEST['show_sticky'] ), 418 ), 419 ); 420 421 // Sticky comes after Publish, or if not listed, after All. 422 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true ); 423 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); 424 } 425 426 return $this->get_views_links( $status_links ); 427 } 428 429 /** 430 * @return array 431 */ 432 protected function get_bulk_actions() { 433 $actions = array(); 434 $post_type_obj = get_post_type_object( $this->screen->post_type ); 435 436 if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { 437 if ( $this->is_trash ) { 438 $actions['untrash'] = __( 'Restore' ); 439 } else { 440 $actions['edit'] = __( 'Edit' ); 441 } 442 } 443 444 if ( current_user_can( $post_type_obj->cap->delete_posts ) ) { 445 if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) { 446 $actions['delete'] = __( 'Delete permanently' ); 447 } else { 448 $actions['trash'] = __( 'Move to Trash' ); 449 } 450 } 451 452 return $actions; 453 } 454 455 /** 456 * Displays a categories drop-down for filtering on the Posts list table. 457 * 458 * @since 4.6.0 459 * 460 * @global int $cat Currently selected category. 461 * 462 * @param string $post_type Post type slug. 463 */ 464 protected function categories_dropdown( $post_type ) { 465 global $cat; 466 467 /** 468 * Filters whether to remove the 'Categories' drop-down from the post list table. 469 * 470 * @since 4.6.0 471 * 472 * @param bool $disable Whether to disable the categories drop-down. Default false. 473 * @param string $post_type Post type slug. 474 */ 475 if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) { 476 return; 477 } 478 479 if ( is_object_in_taxonomy( $post_type, 'category' ) ) { 480 $dropdown_options = array( 481 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, 482 'hide_empty' => 0, 483 'hierarchical' => 1, 484 'show_count' => 0, 485 'orderby' => 'name', 486 'selected' => $cat, 487 ); 488 489 echo '<label class="screen-reader-text" for="cat">' . get_taxonomy( 'category' )->labels->filter_by_item . '</label>'; 490 491 wp_dropdown_categories( $dropdown_options ); 492 } 493 } 494 495 /** 496 * Displays a formats drop-down for filtering items. 497 * 498 * @since 5.2.0 499 * @access protected 500 * 501 * @param string $post_type Post type slug. 502 */ 503 protected function formats_dropdown( $post_type ) { 504 /** 505 * Filters whether to remove the 'Formats' drop-down from the post list table. 506 * 507 * @since 5.2.0 508 * @since 5.5.0 The `$post_type` parameter was added. 509 * 510 * @param bool $disable Whether to disable the drop-down. Default false. 511 * @param string $post_type Post type slug. 512 */ 513 if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) { 514 return; 515 } 516 517 // Return if the post type doesn't have post formats or if we're in the Trash. 518 if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) { 519 return; 520 } 521 522 // Make sure the dropdown shows only formats with a post count greater than 0. 523 $used_post_formats = get_terms( 524 array( 525 'taxonomy' => 'post_format', 526 'hide_empty' => true, 527 ) 528 ); 529 530 // Return if there are no posts using formats. 531 if ( ! $used_post_formats ) { 532 return; 533 } 534 535 $displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : ''; 536 ?> 537 <label for="filter-by-format" class="screen-reader-text"> 538 <?php 539 /* translators: Hidden accessibility text. */ 540 _e( 'Filter by post format' ); 541 ?> 542 </label> 543 <select name="post_format" id="filter-by-format"> 544 <option<?php selected( $displayed_post_format, '' ); ?> value=""><?php _e( 'All formats' ); ?></option> 545 <?php 546 foreach ( $used_post_formats as $used_post_format ) { 547 // Post format slug. 548 $slug = str_replace( 'post-format-', '', $used_post_format->slug ); 549 // Pretty, translated version of the post format slug. 550 $pretty_name = get_post_format_string( $slug ); 551 552 // Skip the standard post format. 553 if ( 'standard' === $slug ) { 554 continue; 555 } 556 ?> 557 <option<?php selected( $displayed_post_format, $slug ); ?> value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $pretty_name ); ?></option> 558 <?php 559 } 560 ?> 561 </select> 562 <?php 563 } 564 565 /** 566 * @param string $which 567 */ 568 protected function extra_tablenav( $which ) { 569 ?> 570 <div class="alignleft actions"> 571 <?php 572 if ( 'top' === $which ) { 573 ob_start(); 574 575 $this->months_dropdown( $this->screen->post_type ); 576 $this->categories_dropdown( $this->screen->post_type ); 577 $this->formats_dropdown( $this->screen->post_type ); 578 579 /** 580 * Fires before the Filter button on the Posts and Pages list tables. 581 * 582 * The Filter button allows sorting by date and/or category on the 583 * Posts list table, and sorting by date on the Pages list table. 584 * 585 * @since 2.1.0 586 * @since 4.4.0 The `$post_type` parameter was added. 587 * @since 4.6.0 The `$which` parameter was added. 588 * 589 * @param string $post_type The post type slug. 590 * @param string $which The location of the extra table nav markup: 591 * 'top' or 'bottom' for WP_Posts_List_Table, 592 * 'bar' for WP_Media_List_Table. 593 */ 594 do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); 595 596 $output = ob_get_clean(); 597 598 if ( ! empty( $output ) ) { 599 echo $output; 600 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); 601 } 602 } 603 604 if ( $this->is_trash && $this->has_items() 605 && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) 606 ) { 607 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); 608 } 609 ?> 610 </div> 611 <?php 612 /** 613 * Fires immediately following the closing "actions" div in the tablenav for the posts 614 * list table. 615 * 616 * @since 4.4.0 617 * 618 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. 619 */ 620 do_action( 'manage_posts_extra_tablenav', $which ); 621 } 622 623 /** 624 * @return string 625 */ 626 public function current_action() { 627 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { 628 return 'delete_all'; 629 } 630 631 return parent::current_action(); 632 } 633 634 /** 635 * @global string $mode List table view mode. 636 * 637 * @return array 638 */ 639 protected function get_table_classes() { 640 global $mode; 641 642 $mode_class = esc_attr( 'table-view-' . $mode ); 643 644 return array( 645 'widefat', 646 'fixed', 647 'striped', 648 $mode_class, 649 is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts', 650 ); 651 } 652 653 /** 654 * @return string[] Array of column titles keyed by their column name. 655 */ 656 public function get_columns() { 657 $post_type = $this->screen->post_type; 658 659 $posts_columns = array(); 660 661 $posts_columns['cb'] = '<input type="checkbox" />'; 662 663 /* translators: Posts screen column name. */ 664 $posts_columns['title'] = _x( 'Title', 'column name' ); 665 666 if ( post_type_supports( $post_type, 'author' ) ) { 667 $posts_columns['author'] = __( 'Author' ); 668 } 669 670 $taxonomies = get_object_taxonomies( $post_type, 'objects' ); 671 $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); 672 673 /** 674 * Filters the taxonomy columns in the Posts list table. 675 * 676 * The dynamic portion of the hook name, `$post_type`, refers to the post 677 * type slug. 678 * 679 * Possible hook names include: 680 * 681 * - `manage_taxonomies_for_post_columns` 682 * - `manage_taxonomies_for_page_columns` 683 * 684 * @since 3.5.0 685 * 686 * @param string[] $taxonomies Array of taxonomy names to show columns for. 687 * @param string $post_type The post type. 688 */ 689 $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); 690 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); 691 692 foreach ( $taxonomies as $taxonomy ) { 693 if ( 'category' === $taxonomy ) { 694 $column_key = 'categories'; 695 } elseif ( 'post_tag' === $taxonomy ) { 696 $column_key = 'tags'; 697 } else { 698 $column_key = 'taxonomy-' . $taxonomy; 699 } 700 701 $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; 702 } 703 704 $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; 705 706 if ( post_type_supports( $post_type, 'comments' ) 707 && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) 708 ) { 709 $posts_columns['comments'] = sprintf( 710 '<span class="vers comment-grey-bubble" title="%1$s" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span>', 711 esc_attr__( 'Comments' ), 712 /* translators: Hidden accessibility text. */ 713 __( 'Comments' ) 714 ); 715 } 716 717 $posts_columns['date'] = __( 'Date' ); 718 719 if ( 'page' === $post_type ) { 720 721 /** 722 * Filters the columns displayed in the Pages list table. 723 * 724 * @since 2.5.0 725 * 726 * @param string[] $post_columns An associative array of column headings. 727 */ 728 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); 729 } else { 730 731 /** 732 * Filters the columns displayed in the Posts list table. 733 * 734 * @since 1.5.0 735 * 736 * @param string[] $post_columns An associative array of column headings. 737 * @param string $post_type The post type slug. 738 */ 739 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); 740 } 741 742 /** 743 * Filters the columns displayed in the Posts list table for a specific post type. 744 * 745 * The dynamic portion of the hook name, `$post_type`, refers to the post type slug. 746 * 747 * Possible hook names include: 748 * 749 * - `manage_post_posts_columns` 750 * - `manage_page_posts_columns` 751 * 752 * @since 3.0.0 753 * 754 * @param string[] $post_columns An associative array of column headings. 755 */ 756 return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); 757 } 758 759 /** 760 * @return array 761 */ 762 protected function get_sortable_columns() { 763 764 $post_type = $this->screen->post_type; 765 766 if ( 'page' === $post_type ) { 767 if ( isset( $_GET['orderby'] ) ) { 768 $title_orderby_text = __( 'Table ordered by Title.' ); 769 } else { 770 $title_orderby_text = __( 'Table ordered by Hierarchical Menu Order and Title.' ); 771 } 772 773 $sortables = array( 774 'title' => array( 'title', false, __( 'Title' ), $title_orderby_text, 'asc' ), 775 'parent' => array( 'parent', false ), 776 'comments' => array( 'comment_count', false, __( 'Comments' ), __( 'Table ordered by Comments.' ) ), 777 'date' => array( 'date', true, __( 'Date' ), __( 'Table ordered by Date.' ) ), 778 ); 779 } else { 780 $sortables = array( 781 'title' => array( 'title', false, __( 'Title' ), __( 'Table ordered by Title.' ) ), 782 'parent' => array( 'parent', false ), 783 'comments' => array( 'comment_count', false, __( 'Comments' ), __( 'Table ordered by Comments.' ) ), 784 'date' => array( 'date', true, __( 'Date' ), __( 'Table ordered by Date.' ), 'desc' ), 785 ); 786 } 787 // Custom Post Types: there's a filter for that, see get_column_info(). 788 789 return $sortables; 790 } 791 792 /** 793 * @global WP_Query $wp_query WordPress Query object. 794 * @global int $per_page 795 * @param array $posts 796 * @param int $level 797 */ 798 public function display_rows( $posts = array(), $level = 0 ) { 799 global $wp_query, $per_page; 800 801 if ( empty( $posts ) ) { 802 $posts = $wp_query->posts; 803 } 804 805 add_filter( 'the_title', 'esc_html' ); 806 807 if ( $this->hierarchical_display ) { 808 $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); 809 } else { 810 $this->_display_rows( $posts, $level ); 811 } 812 } 813 814 /** 815 * @param array $posts 816 * @param int $level 817 */ 818 private function _display_rows( $posts, $level = 0 ) { 819 $post_type = $this->screen->post_type; 820 821 // Create array of post IDs. 822 $post_ids = array(); 823 824 foreach ( $posts as $a_post ) { 825 $post_ids[] = $a_post->ID; 826 } 827 828 if ( post_type_supports( $post_type, 'comments' ) ) { 829 $this->comment_pending_count = get_pending_comments_num( $post_ids ); 830 } 831 update_post_author_caches( $posts ); 832 833 foreach ( $posts as $post ) { 834 $this->single_row( $post, $level ); 835 } 836 } 837 838 /** 839 * @global wpdb $wpdb WordPress database abstraction object. 840 * @global WP_Post $post Global post object. 841 * @param array $pages 842 * @param int $pagenum 843 * @param int $per_page 844 */ 845 private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) { 846 global $wpdb; 847 848 $level = 0; 849 850 if ( ! $pages ) { 851 $pages = get_pages( array( 'sort_column' => 'menu_order' ) ); 852 853 if ( ! $pages ) { 854 return; 855 } 856 } 857 858 /* 859 * Arrange pages into two parts: top level pages and children_pages. 860 * children_pages is two dimensional array. Example: 861 * children_pages[10][] contains all sub-pages whose parent is 10. 862 * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations 863 * If searching, ignore hierarchy and treat everything as top level 864 */ 865 if ( empty( $_REQUEST['s'] ) ) { 866 $top_level_pages = array(); 867 $children_pages = array(); 868 869 foreach ( $pages as $page ) { 870 // Catch and repair bad pages. 871 if ( $page->post_parent === $page->ID ) { 872 $page->post_parent = 0; 873 $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); 874 clean_post_cache( $page ); 875 } 876 877 if ( $page->post_parent > 0 ) { 878 $children_pages[ $page->post_parent ][] = $page; 879 } else { 880 $top_level_pages[] = $page; 881 } 882 } 883 884 $pages = &$top_level_pages; 885 } 886 887 $count = 0; 888 $start = ( $pagenum - 1 ) * $per_page; 889 $end = $start + $per_page; 890 $to_display = array(); 891 892 foreach ( $pages as $page ) { 893 if ( $count >= $end ) { 894 break; 895 } 896 897 if ( $count >= $start ) { 898 $to_display[ $page->ID ] = $level; 899 } 900 901 ++$count; 902 903 if ( isset( $children_pages ) ) { 904 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); 905 } 906 } 907 908 // If it is the last pagenum and there are orphaned pages, display them with paging as well. 909 if ( isset( $children_pages ) && $count < $end ) { 910 foreach ( $children_pages as $orphans ) { 911 foreach ( $orphans as $op ) { 912 if ( $count >= $end ) { 913 break; 914 } 915 916 if ( $count >= $start ) { 917 $to_display[ $op->ID ] = 0; 918 } 919 920 ++$count; 921 } 922 } 923 } 924 925 $ids = array_keys( $to_display ); 926 _prime_post_caches( $ids ); 927 $_posts = array_map( 'get_post', $ids ); 928 update_post_author_caches( $_posts ); 929 930 if ( ! isset( $GLOBALS['post'] ) ) { 931 $GLOBALS['post'] = reset( $ids ); 932 } 933 934 foreach ( $to_display as $page_id => $level ) { 935 echo "\t"; 936 $this->single_row( $page_id, $level ); 937 } 938 } 939 940 /** 941 * Displays the nested hierarchy of sub-pages together with paging 942 * support, based on a top level page ID. 943 * 944 * @since 3.1.0 (Standalone function exists since 2.6.0) 945 * @since 4.2.0 Added the `$to_display` parameter. 946 * 947 * @param array $children_pages 948 * @param int $count 949 * @param int $parent_page 950 * @param int $level 951 * @param int $pagenum 952 * @param int $per_page 953 * @param array $to_display List of pages to be displayed. Passed by reference. 954 */ 955 private function _page_rows( &$children_pages, &$count, $parent_page, $level, $pagenum, $per_page, &$to_display ) { 956 if ( ! isset( $children_pages[ $parent_page ] ) ) { 957 return; 958 } 959 960 $start = ( $pagenum - 1 ) * $per_page; 961 $end = $start + $per_page; 962 963 foreach ( $children_pages[ $parent_page ] as $page ) { 964 if ( $count >= $end ) { 965 break; 966 } 967 968 // If the page starts in a subtree, print the parents. 969 if ( $count === $start && $page->post_parent > 0 ) { 970 $my_parents = array(); 971 $my_parent = $page->post_parent; 972 973 while ( $my_parent ) { 974 // Get the ID from the list or the attribute if my_parent is an object. 975 $parent_id = $my_parent; 976 977 if ( is_object( $my_parent ) ) { 978 $parent_id = $my_parent->ID; 979 } 980 981 $my_parent = get_post( $parent_id ); 982 $my_parents[] = $my_parent; 983 984 if ( ! $my_parent->post_parent ) { 985 break; 986 } 987 988 $my_parent = $my_parent->post_parent; 989 } 990 991 $num_parents = count( $my_parents ); 992 993 while ( $my_parent = array_pop( $my_parents ) ) { 994 $to_display[ $my_parent->ID ] = $level - $num_parents; 995 --$num_parents; 996 } 997 } 998 999 if ( $count >= $start ) { 1000 $to_display[ $page->ID ] = $level; 1001 } 1002 1003 ++$count; 1004 1005 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); 1006 } 1007 1008 unset( $children_pages[ $parent_page ] ); // Required in order to keep track of orphans. 1009 } 1010 1011 /** 1012 * Handles the checkbox column output. 1013 * 1014 * @since 4.3.0 1015 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. 1016 * 1017 * @param WP_Post $item The current WP_Post object. 1018 */ 1019 public function column_cb( $item ) { 1020 // Restores the more descriptive, specific name for use within this method. 1021 $post = $item; 1022 1023 $show = current_user_can( 'edit_post', $post->ID ); 1024 1025 /** 1026 * Filters whether to show the bulk edit checkbox for a post in its list table. 1027 * 1028 * By default the checkbox is only shown if the current user can edit the post. 1029 * 1030 * @since 5.7.0 1031 * 1032 * @param bool $show Whether to show the checkbox. 1033 * @param WP_Post $post The current WP_Post object. 1034 */ 1035 if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) : 1036 ?> 1037 <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" /> 1038 <label for="cb-select-<?php the_ID(); ?>"> 1039 <span class="screen-reader-text"> 1040 <?php 1041 /* translators: %s: Post title. */ 1042 printf( __( 'Select %s' ), _draft_or_post_title() ); 1043 ?> 1044 </span> 1045 </label> 1046 <div class="locked-indicator"> 1047 <span class="locked-indicator-icon" aria-hidden="true"></span> 1048 <span class="screen-reader-text"> 1049 <?php 1050 printf( 1051 /* translators: Hidden accessibility text. %s: Post title. */ 1052 __( '“%s” is locked' ), 1053 _draft_or_post_title() 1054 ); 1055 ?> 1056 </span> 1057 </div> 1058 <?php 1059 endif; 1060 } 1061 1062 /** 1063 * @since 4.3.0 1064 * 1065 * @param WP_Post $post 1066 * @param string $classes 1067 * @param string $data 1068 * @param string $primary 1069 */ 1070 protected function _column_title( $post, $classes, $data, $primary ) { 1071 echo '<td class="' . $classes . ' page-title" ', $data, '>'; 1072 echo $this->column_title( $post ); 1073 echo $this->handle_row_actions( $post, 'title', $primary ); 1074 echo '</td>'; 1075 } 1076 1077 /** 1078 * Handles the title column output. 1079 * 1080 * @since 4.3.0 1081 * 1082 * @global string $mode List table view mode. 1083 * 1084 * @param WP_Post $post The current WP_Post object. 1085 */ 1086 public function column_title( $post ) { 1087 global $mode; 1088 1089 if ( $this->hierarchical_display ) { 1090 if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) { 1091 // Sent level 0 by accident, by default, or because we don't know the actual level. 1092 $find_main_page = (int) $post->post_parent; 1093 1094 while ( $find_main_page > 0 ) { 1095 $parent = get_post( $find_main_page ); 1096 1097 if ( is_null( $parent ) ) { 1098 break; 1099 } 1100 1101 ++$this->current_level; 1102 $find_main_page = (int) $parent->post_parent; 1103 1104 if ( ! isset( $parent_name ) ) { 1105 /** This filter is documented in wp-includes/post-template.php */ 1106 $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); 1107 } 1108 } 1109 } 1110 } 1111 1112 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 1113 1114 if ( $can_edit_post && 'trash' !== $post->post_status ) { 1115 $lock_holder = wp_check_post_lock( $post->ID ); 1116 1117 if ( $lock_holder ) { 1118 $lock_holder = get_userdata( $lock_holder ); 1119 $locked_avatar = get_avatar( $lock_holder->ID, 18 ); 1120 /* translators: %s: User's display name. */ 1121 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); 1122 } else { 1123 $locked_avatar = ''; 1124 $locked_text = ''; 1125 } 1126 1127 echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; 1128 } 1129 1130 $pad = str_repeat( '— ', $this->current_level ); 1131 echo '<strong>'; 1132 1133 $title = _draft_or_post_title(); 1134 1135 if ( $can_edit_post && 'trash' !== $post->post_status ) { 1136 printf( 1137 '<a class="row-title" href="%s" aria-label="%s">%s%s</a>', 1138 get_edit_post_link( $post->ID ), 1139 /* translators: %s: Post title. */ 1140 esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), 1141 $pad, 1142 $title 1143 ); 1144 } else { 1145 printf( 1146 '<span>%s%s</span>', 1147 $pad, 1148 $title 1149 ); 1150 } 1151 _post_states( $post ); 1152 1153 if ( isset( $parent_name ) ) { 1154 $post_type_object = get_post_type_object( $post->post_type ); 1155 echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ); 1156 } 1157 1158 echo "</strong>\n"; 1159 1160 if ( 'excerpt' === $mode 1161 && ! is_post_type_hierarchical( $this->screen->post_type ) 1162 && current_user_can( 'read_post', $post->ID ) 1163 ) { 1164 if ( post_password_required( $post ) ) { 1165 echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>'; 1166 } else { 1167 echo esc_html( get_the_excerpt() ); 1168 } 1169 } 1170 1171 /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */ 1172 $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type ); 1173 1174 if ( $quick_edit_enabled ) { 1175 get_inline_data( $post ); 1176 } 1177 } 1178 1179 /** 1180 * Handles the post date column output. 1181 * 1182 * @since 4.3.0 1183 * 1184 * @global string $mode List table view mode. 1185 * 1186 * @param WP_Post $post The current WP_Post object. 1187 */ 1188 public function column_date( $post ) { 1189 global $mode; 1190 1191 if ( '0000-00-00 00:00:00' === $post->post_date ) { 1192 $t_time = __( 'Unpublished' ); 1193 $time_diff = 0; 1194 } else { 1195 $t_time = sprintf( 1196 /* translators: 1: Post date, 2: Post time. */ 1197 __( '%1$s at %2$s' ), 1198 /* translators: Post date format. See https://www.php.net/manual/datetime.format.php */ 1199 get_the_time( __( 'Y/m/d' ), $post ), 1200 /* translators: Post time format. See https://www.php.net/manual/datetime.format.php */ 1201 get_the_time( __( 'g:i a' ), $post ) 1202 ); 1203 1204 $time = get_post_timestamp( $post ); 1205 $time_diff = time() - $time; 1206 } 1207 1208 if ( 'publish' === $post->post_status ) { 1209 $status = __( 'Published' ); 1210 } elseif ( 'future' === $post->post_status ) { 1211 if ( $time_diff > 0 ) { 1212 $status = '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>'; 1213 } else { 1214 $status = __( 'Scheduled' ); 1215 } 1216 } else { 1217 $status = __( 'Last Modified' ); 1218 } 1219 1220 /** 1221 * Filters the status text of the post. 1222 * 1223 * @since 4.8.0 1224 * 1225 * @param string $status The status text. 1226 * @param WP_Post $post Post object. 1227 * @param string $column_name The column name. 1228 * @param string $mode The list display mode ('excerpt' or 'list'). 1229 */ 1230 $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); 1231 1232 if ( $status ) { 1233 echo $status . '<br />'; 1234 } 1235 1236 /** 1237 * Filters the published, scheduled, or unpublished time of the post. 1238 * 1239 * @since 2.5.1 1240 * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes. 1241 * The published time and date are both displayed now, 1242 * which is equivalent to the previous 'excerpt' mode. 1243 * 1244 * @param string $t_time The published time. 1245 * @param WP_Post $post Post object. 1246 * @param string $column_name The column name. 1247 * @param string $mode The list display mode ('excerpt' or 'list'). 1248 */ 1249 echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); 1250 } 1251 1252 /** 1253 * Handles the comments column output. 1254 * 1255 * @since 4.3.0 1256 * 1257 * @param WP_Post $post The current WP_Post object. 1258 */ 1259 public function column_comments( $post ) { 1260 ?> 1261 <div class="post-com-count-wrapper"> 1262 <?php 1263 $pending_comments = isset( $this->comment_pending_count[ $post->ID ] ) ? $this->comment_pending_count[ $post->ID ] : 0; 1264 1265 $this->comments_bubble( $post->ID, $pending_comments ); 1266 ?> 1267 </div> 1268 <?php 1269 } 1270 1271 /** 1272 * Handles the post author column output. 1273 * 1274 * @since 4.3.0 1275 * 1276 * @param WP_Post $post The current WP_Post object. 1277 */ 1278 public function column_author( $post ) { 1279 $args = array( 1280 'post_type' => $post->post_type, 1281 'author' => get_the_author_meta( 'ID' ), 1282 ); 1283 echo $this->get_edit_link( $args, get_the_author() ); 1284 } 1285 1286 /** 1287 * Handles the default column output. 1288 * 1289 * @since 4.3.0 1290 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. 1291 * 1292 * @param WP_Post $item The current WP_Post object. 1293 * @param string $column_name The current column name. 1294 */ 1295 public function column_default( $item, $column_name ) { 1296 // Restores the more descriptive, specific name for use within this method. 1297 $post = $item; 1298 1299 if ( 'categories' === $column_name ) { 1300 $taxonomy = 'category'; 1301 } elseif ( 'tags' === $column_name ) { 1302 $taxonomy = 'post_tag'; 1303 } elseif ( str_starts_with( $column_name, 'taxonomy-' ) ) { 1304 $taxonomy = substr( $column_name, 9 ); 1305 } else { 1306 $taxonomy = false; 1307 } 1308 1309 if ( $taxonomy ) { 1310 $taxonomy_object = get_taxonomy( $taxonomy ); 1311 $terms = get_the_terms( $post->ID, $taxonomy ); 1312 1313 if ( is_array( $terms ) ) { 1314 $term_links = array(); 1315 1316 foreach ( $terms as $t ) { 1317 $posts_in_term_qv = array(); 1318 1319 if ( 'post' !== $post->post_type ) { 1320 $posts_in_term_qv['post_type'] = $post->post_type; 1321 } 1322 1323 if ( $taxonomy_object->query_var ) { 1324 $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug; 1325 } else { 1326 $posts_in_term_qv['taxonomy'] = $taxonomy; 1327 $posts_in_term_qv['term'] = $t->slug; 1328 } 1329 1330 $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); 1331 1332 $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label ); 1333 } 1334 1335 /** 1336 * Filters the links in `$taxonomy` column of edit.php. 1337 * 1338 * @since 5.2.0 1339 * 1340 * @param string[] $term_links Array of term editing links. 1341 * @param string $taxonomy Taxonomy name. 1342 * @param WP_Term[] $terms Array of term objects appearing in the post row. 1343 */ 1344 $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); 1345 1346 echo implode( wp_get_list_item_separator(), $term_links ); 1347 } else { 1348 echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>'; 1349 } 1350 return; 1351 } 1352 1353 if ( is_post_type_hierarchical( $post->post_type ) ) { 1354 1355 /** 1356 * Fires in each custom column on the Posts list table. 1357 * 1358 * This hook only fires if the current post type is hierarchical, 1359 * such as pages. 1360 * 1361 * @since 2.5.0 1362 * 1363 * @param string $column_name The name of the column to display. 1364 * @param int $post_id The current post ID. 1365 */ 1366 do_action( 'manage_pages_custom_column', $column_name, $post->ID ); 1367 } else { 1368 1369 /** 1370 * Fires in each custom column in the Posts list table. 1371 * 1372 * This hook only fires if the current post type is non-hierarchical, 1373 * such as posts. 1374 * 1375 * @since 1.5.0 1376 * 1377 * @param string $column_name The name of the column to display. 1378 * @param int $post_id The current post ID. 1379 */ 1380 do_action( 'manage_posts_custom_column', $column_name, $post->ID ); 1381 } 1382 1383 /** 1384 * Fires for each custom column of a specific post type in the Posts list table. 1385 * 1386 * The dynamic portion of the hook name, `$post->post_type`, refers to the post type. 1387 * 1388 * Possible hook names include: 1389 * 1390 * - `manage_post_posts_custom_column` 1391 * - `manage_page_posts_custom_column` 1392 * 1393 * @since 3.1.0 1394 * 1395 * @param string $column_name The name of the column to display. 1396 * @param int $post_id The current post ID. 1397 */ 1398 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 1399 } 1400 1401 /** 1402 * @global WP_Post $post Global post object. 1403 * 1404 * @param int|WP_Post $post 1405 * @param int $level 1406 */ 1407 public function single_row( $post, $level = 0 ) { 1408 $global_post = get_post(); 1409 1410 $post = get_post( $post ); 1411 $this->current_level = $level; 1412 1413 $GLOBALS['post'] = $post; 1414 setup_postdata( $post ); 1415 1416 $classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' ); 1417 1418 $lock_holder = wp_check_post_lock( $post->ID ); 1419 1420 if ( $lock_holder ) { 1421 $classes .= ' wp-locked'; 1422 } 1423 1424 if ( $post->post_parent ) { 1425 $count = count( get_post_ancestors( $post->ID ) ); 1426 $classes .= ' level-' . $count; 1427 } else { 1428 $classes .= ' level-0'; 1429 } 1430 ?> 1431 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> 1432 <?php $this->single_row_columns( $post ); ?> 1433 </tr> 1434 <?php 1435 $GLOBALS['post'] = $global_post; 1436 } 1437 1438 /** 1439 * Gets the name of the default primary column. 1440 * 1441 * @since 4.3.0 1442 * 1443 * @return string Name of the default primary column, in this case, 'title'. 1444 */ 1445 protected function get_default_primary_column_name() { 1446 return 'title'; 1447 } 1448 1449 /** 1450 * Generates and displays row action links. 1451 * 1452 * @since 4.3.0 1453 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. 1454 * 1455 * @param WP_Post $item Post being acted upon. 1456 * @param string $column_name Current column name. 1457 * @param string $primary Primary column name. 1458 * @return string Row actions output for posts, or an empty string 1459 * if the current column is not the primary column. 1460 */ 1461 protected function handle_row_actions( $item, $column_name, $primary ) { 1462 if ( $primary !== $column_name ) { 1463 return ''; 1464 } 1465 1466 // Restores the more descriptive, specific name for use within this method. 1467 $post = $item; 1468 1469 $post_type_object = get_post_type_object( $post->post_type ); 1470 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 1471 $actions = array(); 1472 $title = _draft_or_post_title(); 1473 1474 if ( $can_edit_post && 'trash' !== $post->post_status ) { 1475 $actions['edit'] = sprintf( 1476 '<a href="%s" aria-label="%s">%s</a>', 1477 get_edit_post_link( $post->ID ), 1478 /* translators: %s: Post title. */ 1479 esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), 1480 __( 'Edit' ) 1481 ); 1482 1483 /** 1484 * Filters whether Quick Edit should be enabled for the given post type. 1485 * 1486 * @since 6.4.0 1487 * 1488 * @param bool $enable Whether to enable the Quick Edit functionality. Default true. 1489 * @param string $post_type Post type name. 1490 */ 1491 $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type ); 1492 1493 if ( $quick_edit_enabled && 'wp_block' !== $post->post_type ) { 1494 $actions['inline hide-if-no-js'] = sprintf( 1495 '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>', 1496 /* translators: %s: Post title. */ 1497 esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), 1498 __( 'Quick Edit' ) 1499 ); 1500 } 1501 } 1502 1503 if ( current_user_can( 'delete_post', $post->ID ) ) { 1504 if ( 'trash' === $post->post_status ) { 1505 $actions['untrash'] = sprintf( 1506 '<a href="%s" aria-label="%s">%s</a>', 1507 wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ), 1508 /* translators: %s: Post title. */ 1509 esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ), 1510 __( 'Restore' ) 1511 ); 1512 } elseif ( EMPTY_TRASH_DAYS ) { 1513 $actions['trash'] = sprintf( 1514 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 1515 get_delete_post_link( $post->ID ), 1516 /* translators: %s: Post title. */ 1517 esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ), 1518 _x( 'Trash', 'verb' ) 1519 ); 1520 } 1521 1522 if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) { 1523 $actions['delete'] = sprintf( 1524 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 1525 get_delete_post_link( $post->ID, '', true ), 1526 /* translators: %s: Post title. */ 1527 esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ), 1528 __( 'Delete Permanently' ) 1529 ); 1530 } 1531 } 1532 1533 if ( is_post_type_viewable( $post_type_object ) ) { 1534 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) { 1535 if ( $can_edit_post ) { 1536 $preview_link = get_preview_post_link( $post ); 1537 $actions['view'] = sprintf( 1538 '<a href="%s" rel="bookmark" aria-label="%s">%s</a>', 1539 esc_url( $preview_link ), 1540 /* translators: %s: Post title. */ 1541 esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), 1542 __( 'Preview' ) 1543 ); 1544 } 1545 } elseif ( 'trash' !== $post->post_status ) { 1546 $actions['view'] = sprintf( 1547 '<a href="%s" rel="bookmark" aria-label="%s">%s</a>', 1548 get_permalink( $post->ID ), 1549 /* translators: %s: Post title. */ 1550 esc_attr( sprintf( __( 'View “%s”' ), $title ) ), 1551 __( 'View' ) 1552 ); 1553 } 1554 } 1555 1556 if ( 'wp_block' === $post->post_type ) { 1557 $actions['export'] = sprintf( 1558 '<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>', 1559 $post->ID, 1560 /* translators: %s: Post title. */ 1561 esc_attr( sprintf( __( 'Export “%s” as JSON' ), $title ) ), 1562 __( 'Export as JSON' ) 1563 ); 1564 } 1565 1566 if ( is_post_type_hierarchical( $post->post_type ) ) { 1567 1568 /** 1569 * Filters the array of row action links on the Pages list table. 1570 * 1571 * The filter is evaluated only for hierarchical post types. 1572 * 1573 * @since 2.8.0 1574 * 1575 * @param string[] $actions An array of row action links. Defaults are 1576 * 'Edit', 'Quick Edit', 'Restore', 'Trash', 1577 * 'Delete Permanently', 'Preview', and 'View'. 1578 * @param WP_Post $post The post object. 1579 */ 1580 $actions = apply_filters( 'page_row_actions', $actions, $post ); 1581 } else { 1582 1583 /** 1584 * Filters the array of row action links on the Posts list table. 1585 * 1586 * The filter is evaluated only for non-hierarchical post types. 1587 * 1588 * @since 2.8.0 1589 * 1590 * @param string[] $actions An array of row action links. Defaults are 1591 * 'Edit', 'Quick Edit', 'Restore', 'Trash', 1592 * 'Delete Permanently', 'Preview', and 'View'. 1593 * @param WP_Post $post The post object. 1594 */ 1595 $actions = apply_filters( 'post_row_actions', $actions, $post ); 1596 } 1597 1598 return $this->row_actions( $actions ); 1599 } 1600 1601 /** 1602 * Outputs the hidden row displayed when inline editing 1603 * 1604 * @since 3.1.0 1605 * 1606 * @global string $mode List table view mode. 1607 */ 1608 public function inline_edit() { 1609 global $mode; 1610 1611 $screen = $this->screen; 1612 1613 $post = get_default_post_to_edit( $screen->post_type ); 1614 $post_type_object = get_post_type_object( $screen->post_type ); 1615 1616 $taxonomy_names = get_object_taxonomies( $screen->post_type ); 1617 $hierarchical_taxonomies = array(); 1618 $flat_taxonomies = array(); 1619 1620 foreach ( $taxonomy_names as $taxonomy_name ) { 1621 $taxonomy = get_taxonomy( $taxonomy_name ); 1622 1623 $show_in_quick_edit = $taxonomy->show_in_quick_edit; 1624 1625 /** 1626 * Filters whether the current taxonomy should be shown in the Quick Edit panel. 1627 * 1628 * @since 4.2.0 1629 * 1630 * @param bool $show_in_quick_edit Whether to show the current taxonomy in Quick Edit. 1631 * @param string $taxonomy_name Taxonomy name. 1632 * @param string $post_type Post type of current Quick Edit post. 1633 */ 1634 if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) { 1635 continue; 1636 } 1637 1638 if ( $taxonomy->hierarchical ) { 1639 $hierarchical_taxonomies[] = $taxonomy; 1640 } else { 1641 $flat_taxonomies[] = $taxonomy; 1642 } 1643 } 1644 1645 $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; 1646 $can_publish = current_user_can( $post_type_object->cap->publish_posts ); 1647 $core_columns = array( 1648 'cb' => true, 1649 'date' => true, 1650 'title' => true, 1651 'categories' => true, 1652 'tags' => true, 1653 'comments' => true, 1654 'author' => true, 1655 ); 1656 ?> 1657 1658 <form method="get"> 1659 <table style="display: none"><tbody id="inlineedit"> 1660 <?php 1661 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page'; 1662 $inline_edit_classes = "inline-edit-row inline-edit-row-$hclass"; 1663 $bulk_edit_classes = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}"; 1664 $quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; 1665 1666 $bulk = 0; 1667 1668 while ( $bulk < 2 ) : 1669 $classes = $inline_edit_classes . ' '; 1670 $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes; 1671 ?> 1672 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $classes; ?>" style="display: none"> 1673 <td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 1674 <div class="inline-edit-wrapper" role="region" aria-labelledby="<?php echo $bulk ? 'bulk' : 'quick'; ?>-edit-legend"> 1675 <fieldset class="inline-edit-col-left"> 1676 <legend class="inline-edit-legend" id="<?php echo $bulk ? 'bulk' : 'quick'; ?>-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend> 1677 <div class="inline-edit-col"> 1678 1679 <?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?> 1680 1681 <?php if ( $bulk ) : ?> 1682 1683 <div id="bulk-title-div"> 1684 <div id="bulk-titles"></div> 1685 </div> 1686 1687 <?php else : // $bulk ?> 1688 1689 <label> 1690 <span class="title"><?php _e( 'Title' ); ?></span> 1691 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> 1692 </label> 1693 1694 <?php if ( is_post_type_viewable( $screen->post_type ) ) : ?> 1695 1696 <label> 1697 <span class="title"><?php _e( 'Slug' ); ?></span> 1698 <span class="input-text-wrap"><input type="text" name="post_name" value="" autocomplete="off" spellcheck="false" /></span> 1699 </label> 1700 1701 <?php endif; // is_post_type_viewable() ?> 1702 1703 <?php endif; // $bulk ?> 1704 1705 <?php endif; // post_type_supports( ... 'title' ) ?> 1706 1707 <?php if ( ! $bulk ) : ?> 1708 <fieldset class="inline-edit-date"> 1709 <legend><span class="title"><?php _e( 'Date' ); ?></span></legend> 1710 <?php touch_time( 1, 1, 0, 1 ); ?> 1711 </fieldset> 1712 <br class="clear" /> 1713 <?php endif; // $bulk ?> 1714 1715 <?php 1716 if ( post_type_supports( $screen->post_type, 'author' ) ) { 1717 $authors_dropdown = ''; 1718 1719 if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) { 1720 $dropdown_name = 'post_author'; 1721 $dropdown_class = 'authors'; 1722 if ( wp_is_large_user_count() ) { 1723 $authors_dropdown = sprintf( '<select name="%s" class="%s hidden"></select>', esc_attr( $dropdown_name ), esc_attr( $dropdown_class ) ); 1724 } else { 1725 $users_opt = array( 1726 'hide_if_only_one_author' => false, 1727 'capability' => array( $post_type_object->cap->edit_posts ), 1728 'name' => $dropdown_name, 1729 'class' => $dropdown_class, 1730 'multi' => 1, 1731 'echo' => 0, 1732 'show' => 'display_name_with_login', 1733 ); 1734 1735 if ( $bulk ) { 1736 $users_opt['show_option_none'] = __( '— No Change —' ); 1737 } 1738 1739 /** 1740 * Filters the arguments used to generate the Quick Edit authors drop-down. 1741 * 1742 * @since 5.6.0 1743 * 1744 * @see wp_dropdown_users() 1745 * 1746 * @param array $users_opt An array of arguments passed to wp_dropdown_users(). 1747 * @param bool $bulk A flag to denote if it's a bulk action. 1748 */ 1749 $users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt, $bulk ); 1750 1751 $authors = wp_dropdown_users( $users_opt ); 1752 1753 if ( $authors ) { 1754 $authors_dropdown = '<label class="inline-edit-author">'; 1755 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; 1756 $authors_dropdown .= $authors; 1757 $authors_dropdown .= '</label>'; 1758 } 1759 } 1760 } // current_user_can( 'edit_others_posts' ) 1761 1762 if ( ! $bulk ) { 1763 echo $authors_dropdown; 1764 } 1765 } // post_type_supports( ... 'author' ) 1766 ?> 1767 1768 <?php if ( ! $bulk && $can_publish ) : ?> 1769 1770 <div class="inline-edit-group wp-clearfix"> 1771 <label class="alignleft"> 1772 <span class="title"><?php _e( 'Password' ); ?></span> 1773 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> 1774 </label> 1775 1776 <span class="alignleft inline-edit-or"> 1777 <?php 1778 /* translators: Between password field and private checkbox on post quick edit interface. */ 1779 _e( '–OR–' ); 1780 ?> 1781 </span> 1782 <label class="alignleft inline-edit-private"> 1783 <input type="checkbox" name="keep_private" value="private" /> 1784 <span class="checkbox-title"><?php _e( 'Private' ); ?></span> 1785 </label> 1786 </div> 1787 1788 <?php endif; ?> 1789 1790 </div> 1791 </fieldset> 1792 1793 <?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?> 1794 1795 <fieldset class="inline-edit-col-center inline-edit-categories"> 1796 <div class="inline-edit-col"> 1797 1798 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> 1799 1800 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span> 1801 <input type="hidden" name="<?php echo ( 'category' === $taxonomy->name ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> 1802 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist"> 1803 <?php wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name ) ); ?> 1804 </ul> 1805 1806 <?php endforeach; // $hierarchical_taxonomies as $taxonomy ?> 1807 1808 </div> 1809 </fieldset> 1810 1811 <?php endif; // count( $hierarchical_taxonomies ) && ! $bulk ?> 1812 1813 <fieldset class="inline-edit-col-right"> 1814 <div class="inline-edit-col"> 1815 1816 <?php 1817 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) { 1818 echo $authors_dropdown; 1819 } 1820 ?> 1821 1822 <?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : ?> 1823 1824 <?php if ( $post_type_object->hierarchical ) : ?> 1825 1826 <label> 1827 <span class="title"><?php _e( 'Parent' ); ?></span> 1828 <?php 1829 $dropdown_args = array( 1830 'post_type' => $post_type_object->name, 1831 'selected' => $post->post_parent, 1832 'name' => 'post_parent', 1833 'show_option_none' => __( 'Main Page (no parent)' ), 1834 'option_none_value' => 0, 1835 'sort_column' => 'menu_order, post_title', 1836 ); 1837 1838 if ( $bulk ) { 1839 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); 1840 } 1841 1842 /** 1843 * Filters the arguments used to generate the Quick Edit page-parent drop-down. 1844 * 1845 * @since 2.7.0 1846 * @since 5.6.0 The `$bulk` parameter was added. 1847 * 1848 * @see wp_dropdown_pages() 1849 * 1850 * @param array $dropdown_args An array of arguments passed to wp_dropdown_pages(). 1851 * @param bool $bulk A flag to denote if it's a bulk action. 1852 */ 1853 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args, $bulk ); 1854 1855 wp_dropdown_pages( $dropdown_args ); 1856 ?> 1857 </label> 1858 1859 <?php endif; // hierarchical ?> 1860 1861 <?php if ( ! $bulk ) : ?> 1862 1863 <label> 1864 <span class="title"><?php _e( 'Order' ); ?></span> 1865 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span> 1866 </label> 1867 1868 <?php endif; // ! $bulk ?> 1869 1870 <?php endif; // post_type_supports( ... 'page-attributes' ) ?> 1871 1872 <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?> 1873 1874 <label> 1875 <span class="title"><?php _e( 'Template' ); ?></span> 1876 <select name="page_template"> 1877 <?php if ( $bulk ) : ?> 1878 <option value="-1"><?php _e( '— No Change —' ); ?></option> 1879 <?php endif; // $bulk ?> 1880 <?php 1881 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1882 $default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'quick-edit' ); 1883 ?> 1884 <option value="default"><?php echo esc_html( $default_title ); ?></option> 1885 <?php page_template_dropdown( '', $screen->post_type ); ?> 1886 </select> 1887 </label> 1888 1889 <?php endif; ?> 1890 1891 <?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?> 1892 1893 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?> 1894 1895 <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?> 1896 <?php $taxonomy_name = esc_attr( $taxonomy->name ); ?> 1897 <div class="inline-edit-tags-wrap"> 1898 <label class="inline-edit-tags"> 1899 <span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span> 1900 <textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name ); ?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name ); ?>" aria-describedby="inline-edit-<?php echo esc_attr( $taxonomy->name ); ?>-desc"></textarea> 1901 </label> 1902 <p class="howto" id="inline-edit-<?php echo esc_attr( $taxonomy->name ); ?>-desc"><?php echo esc_html( $taxonomy->labels->separate_items_with_commas ); ?></p> 1903 </div> 1904 <?php endif; // current_user_can( 'assign_terms' ) ?> 1905 1906 <?php endforeach; // $flat_taxonomies as $taxonomy ?> 1907 1908 <?php endif; // count( $flat_taxonomies ) && ! $bulk ?> 1909 1910 <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> 1911 1912 <?php if ( $bulk ) : ?> 1913 1914 <div class="inline-edit-group wp-clearfix"> 1915 1916 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> 1917 1918 <label class="alignleft"> 1919 <span class="title"><?php _e( 'Comments' ); ?></span> 1920 <select name="comment_status"> 1921 <option value=""><?php _e( '— No Change —' ); ?></option> 1922 <option value="open"><?php _e( 'Allow' ); ?></option> 1923 <option value="closed"><?php _e( 'Do not allow' ); ?></option> 1924 </select> 1925 </label> 1926 1927 <?php endif; ?> 1928 1929 <?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> 1930 1931 <label class="alignright"> 1932 <span class="title"><?php _e( 'Pings' ); ?></span> 1933 <select name="ping_status"> 1934 <option value=""><?php _e( '— No Change —' ); ?></option> 1935 <option value="open"><?php _e( 'Allow' ); ?></option> 1936 <option value="closed"><?php _e( 'Do not allow' ); ?></option> 1937 </select> 1938 </label> 1939 1940 <?php endif; ?> 1941 1942 </div> 1943 1944 <?php else : // $bulk ?> 1945 1946 <div class="inline-edit-group wp-clearfix"> 1947 1948 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> 1949 1950 <label class="alignleft"> 1951 <input type="checkbox" name="comment_status" value="open" /> 1952 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span> 1953 </label> 1954 1955 <?php endif; ?> 1956 1957 <?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> 1958 1959 <label class="alignleft"> 1960 <input type="checkbox" name="ping_status" value="open" /> 1961 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span> 1962 </label> 1963 1964 <?php endif; ?> 1965 1966 </div> 1967 1968 <?php endif; // $bulk ?> 1969 1970 <?php endif; // post_type_supports( ... comments or pings ) ?> 1971 1972 <div class="inline-edit-group wp-clearfix"> 1973 1974 <label class="inline-edit-status alignleft"> 1975 <span class="title"><?php _e( 'Status' ); ?></span> 1976 <select name="_status"> 1977 <?php if ( $bulk ) : ?> 1978 <option value="-1"><?php _e( '— No Change —' ); ?></option> 1979 <?php endif; // $bulk ?> 1980 1981 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?> 1982 <option value="publish"><?php _e( 'Published' ); ?></option> 1983 <option value="future"><?php _e( 'Scheduled' ); ?></option> 1984 <?php if ( $bulk ) : ?> 1985 <option value="private"><?php _e( 'Private' ); ?></option> 1986 <?php endif; // $bulk ?> 1987 <?php endif; ?> 1988 1989 <option value="pending"><?php _e( 'Pending Review' ); ?></option> 1990 <option value="draft"><?php _e( 'Draft' ); ?></option> 1991 </select> 1992 </label> 1993 1994 <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> 1995 1996 <?php if ( $bulk ) : ?> 1997 1998 <label class="alignright"> 1999 <span class="title"><?php _e( 'Sticky' ); ?></span> 2000 <select name="sticky"> 2001 <option value="-1"><?php _e( '— No Change —' ); ?></option> 2002 <option value="sticky"><?php _e( 'Sticky' ); ?></option> 2003 <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option> 2004 </select> 2005 </label> 2006 2007 <?php else : // $bulk ?> 2008 2009 <label class="alignleft"> 2010 <input type="checkbox" name="sticky" value="sticky" /> 2011 <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span> 2012 </label> 2013 2014 <?php endif; // $bulk ?> 2015 2016 <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_posts' ) ?> 2017 2018 </div> 2019 2020 <?php if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) : ?> 2021 <?php $post_formats = get_theme_support( 'post-formats' ); ?> 2022 2023 <label class="alignleft"> 2024 <span class="title"><?php _ex( 'Format', 'post format' ); ?></span> 2025 <select name="post_format"> 2026 <option value="-1"><?php _e( '— No Change —' ); ?></option> 2027 <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> 2028 <?php if ( is_array( $post_formats[0] ) ) : ?> 2029 <?php foreach ( $post_formats[0] as $format ) : ?> 2030 <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option> 2031 <?php endforeach; ?> 2032 <?php endif; ?> 2033 </select> 2034 </label> 2035 2036 <?php endif; ?> 2037 2038 </div> 2039 </fieldset> 2040 2041 <?php 2042 list( $columns ) = $this->get_column_info(); 2043 2044 foreach ( $columns as $column_name => $column_display_name ) { 2045 if ( isset( $core_columns[ $column_name ] ) ) { 2046 continue; 2047 } 2048 2049 if ( $bulk ) { 2050 2051 /** 2052 * Fires once for each column in Bulk Edit mode. 2053 * 2054 * @since 2.7.0 2055 * 2056 * @param string $column_name Name of the column to edit. 2057 * @param string $post_type The post type slug. 2058 */ 2059 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type ); 2060 } else { 2061 2062 /** 2063 * Fires once for each column in Quick Edit mode. 2064 * 2065 * @since 2.7.0 2066 * 2067 * @param string $column_name Name of the column to edit. 2068 * @param string $post_type The post type slug, or current screen name if this is a taxonomy list table. 2069 * @param string $taxonomy The taxonomy name, if any. 2070 */ 2071 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' ); 2072 } 2073 } 2074 ?> 2075 2076 <div class="submit inline-edit-save"> 2077 <?php if ( ! $bulk ) : ?> 2078 <?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?> 2079 <button type="button" class="button button-primary save"><?php _e( 'Update' ); ?></button> 2080 <?php else : ?> 2081 <?php submit_button( __( 'Update' ), 'primary', 'bulk_edit', false ); ?> 2082 <?php endif; ?> 2083 2084 <button type="button" class="button cancel"><?php _e( 'Cancel' ); ?></button> 2085 2086 <?php if ( ! $bulk ) : ?> 2087 <span class="spinner"></span> 2088 <?php endif; ?> 2089 2090 <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" /> 2091 <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" /> 2092 <?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?> 2093 <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> 2094 <?php endif; ?> 2095 2096 <?php 2097 wp_admin_notice( 2098 '<p class="error"></p>', 2099 array( 2100 'type' => 'error', 2101 'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ), 2102 'paragraph_wrap' => false, 2103 ) 2104 ); 2105 ?> 2106 </div> 2107 </div> <!-- end of .inline-edit-wrapper --> 2108 2109 </td></tr> 2110 2111 <?php 2112 ++$bulk; 2113 endwhile; 2114 ?> 2115 </tbody></table> 2116 </form> 2117 <?php 2118 } 2119 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Mon Mar 18 08:20:01 2024 | Cross-referenced by PHPXref |