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