53 } |
55 } |
54 } |
56 } |
55 unset( $_redirect ); |
57 unset( $_redirect ); |
56 |
58 |
57 if ( 'post' != $post_type ) { |
59 if ( 'post' != $post_type ) { |
58 $parent_file = "edit.php?post_type=$post_type"; |
60 $parent_file = "edit.php?post_type=$post_type"; |
59 $submenu_file = "edit.php?post_type=$post_type"; |
61 $submenu_file = "edit.php?post_type=$post_type"; |
60 $post_new_file = "post-new.php?post_type=$post_type"; |
62 $post_new_file = "post-new.php?post_type=$post_type"; |
61 } else { |
63 } else { |
62 $parent_file = 'edit.php'; |
64 $parent_file = 'edit.php'; |
63 $submenu_file = 'edit.php'; |
65 $submenu_file = 'edit.php'; |
64 $post_new_file = 'post-new.php'; |
66 $post_new_file = 'post-new.php'; |
65 } |
67 } |
66 |
68 |
67 $doaction = $wp_list_table->current_action(); |
69 $doaction = $wp_list_table->current_action(); |
68 |
70 |
69 if ( $doaction ) { |
71 if ( $doaction ) { |
70 check_admin_referer('bulk-posts'); |
72 check_admin_referer( 'bulk-posts' ); |
71 |
73 |
72 $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() ); |
74 $sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'locked', 'ids' ), wp_get_referer() ); |
73 if ( ! $sendback ) |
75 if ( ! $sendback ) { |
74 $sendback = admin_url( $parent_file ); |
76 $sendback = admin_url( $parent_file ); |
|
77 } |
75 $sendback = add_query_arg( 'paged', $pagenum, $sendback ); |
78 $sendback = add_query_arg( 'paged', $pagenum, $sendback ); |
76 if ( strpos($sendback, 'post.php') !== false ) |
79 if ( strpos( $sendback, 'post.php' ) !== false ) { |
77 $sendback = admin_url($post_new_file); |
80 $sendback = admin_url( $post_new_file ); |
|
81 } |
78 |
82 |
79 if ( 'delete_all' == $doaction ) { |
83 if ( 'delete_all' == $doaction ) { |
80 // Prepare for deletion of all posts with a specified post status (i.e. Empty trash). |
84 // Prepare for deletion of all posts with a specified post status (i.e. Empty trash). |
81 $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']); |
85 $post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] ); |
82 // Validate the post status exists. |
86 // Validate the post status exists. |
83 if ( get_post_status_object( $post_status ) ) { |
87 if ( get_post_status_object( $post_status ) ) { |
84 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) ); |
88 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) ); |
85 } |
89 } |
86 $doaction = 'delete'; |
90 $doaction = 'delete'; |
87 } elseif ( isset( $_REQUEST['media'] ) ) { |
91 } elseif ( isset( $_REQUEST['media'] ) ) { |
88 $post_ids = $_REQUEST['media']; |
92 $post_ids = $_REQUEST['media']; |
89 } elseif ( isset( $_REQUEST['ids'] ) ) { |
93 } elseif ( isset( $_REQUEST['ids'] ) ) { |
90 $post_ids = explode( ',', $_REQUEST['ids'] ); |
94 $post_ids = explode( ',', $_REQUEST['ids'] ); |
91 } elseif ( !empty( $_REQUEST['post'] ) ) { |
95 } elseif ( ! empty( $_REQUEST['post'] ) ) { |
92 $post_ids = array_map('intval', $_REQUEST['post']); |
96 $post_ids = array_map( 'intval', $_REQUEST['post'] ); |
93 } |
97 } |
94 |
98 |
95 if ( !isset( $post_ids ) ) { |
99 if ( ! isset( $post_ids ) ) { |
96 wp_redirect( $sendback ); |
100 wp_redirect( $sendback ); |
97 exit; |
101 exit; |
98 } |
102 } |
99 |
103 |
100 switch ( $doaction ) { |
104 switch ( $doaction ) { |
101 case 'trash': |
105 case 'trash': |
102 $trashed = $locked = 0; |
106 $trashed = $locked = 0; |
103 |
107 |
104 foreach ( (array) $post_ids as $post_id ) { |
108 foreach ( (array) $post_ids as $post_id ) { |
105 if ( !current_user_can( 'delete_post', $post_id) ) |
109 if ( ! current_user_can( 'delete_post', $post_id ) ) { |
106 wp_die( __('Sorry, you are not allowed to move this item to the Trash.') ); |
110 wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
|
111 } |
107 |
112 |
108 if ( wp_check_post_lock( $post_id ) ) { |
113 if ( wp_check_post_lock( $post_id ) ) { |
109 $locked++; |
114 $locked++; |
110 continue; |
115 continue; |
111 } |
116 } |
112 |
117 |
113 if ( !wp_trash_post($post_id) ) |
118 if ( ! wp_trash_post( $post_id ) ) { |
114 wp_die( __('Error in moving to Trash.') ); |
119 wp_die( __( 'Error in moving to Trash.' ) ); |
|
120 } |
115 |
121 |
116 $trashed++; |
122 $trashed++; |
117 } |
123 } |
118 |
124 |
119 $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback ); |
125 $sendback = add_query_arg( |
|
126 array( |
|
127 'trashed' => $trashed, |
|
128 'ids' => join( ',', $post_ids ), |
|
129 'locked' => $locked, |
|
130 ), |
|
131 $sendback |
|
132 ); |
120 break; |
133 break; |
121 case 'untrash': |
134 case 'untrash': |
122 $untrashed = 0; |
135 $untrashed = 0; |
123 foreach ( (array) $post_ids as $post_id ) { |
136 foreach ( (array) $post_ids as $post_id ) { |
124 if ( !current_user_can( 'delete_post', $post_id) ) |
137 if ( ! current_user_can( 'delete_post', $post_id ) ) { |
125 wp_die( __('Sorry, you are not allowed to restore this item from the Trash.') ); |
138 wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
126 |
139 } |
127 if ( !wp_untrash_post($post_id) ) |
140 |
128 wp_die( __('Error in restoring from Trash.') ); |
141 if ( ! wp_untrash_post( $post_id ) ) { |
|
142 wp_die( __( 'Error in restoring from Trash.' ) ); |
|
143 } |
129 |
144 |
130 $untrashed++; |
145 $untrashed++; |
131 } |
146 } |
132 $sendback = add_query_arg('untrashed', $untrashed, $sendback); |
147 $sendback = add_query_arg( 'untrashed', $untrashed, $sendback ); |
133 break; |
148 break; |
134 case 'delete': |
149 case 'delete': |
135 $deleted = 0; |
150 $deleted = 0; |
136 foreach ( (array) $post_ids as $post_id ) { |
151 foreach ( (array) $post_ids as $post_id ) { |
137 $post_del = get_post($post_id); |
152 $post_del = get_post( $post_id ); |
138 |
153 |
139 if ( !current_user_can( 'delete_post', $post_id ) ) |
154 if ( ! current_user_can( 'delete_post', $post_id ) ) { |
140 wp_die( __('Sorry, you are not allowed to delete this item.') ); |
155 wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
|
156 } |
141 |
157 |
142 if ( $post_del->post_type == 'attachment' ) { |
158 if ( $post_del->post_type == 'attachment' ) { |
143 if ( ! wp_delete_attachment($post_id) ) |
159 if ( ! wp_delete_attachment( $post_id ) ) { |
144 wp_die( __('Error in deleting.') ); |
160 wp_die( __( 'Error in deleting.' ) ); |
|
161 } |
145 } else { |
162 } else { |
146 if ( !wp_delete_post($post_id) ) |
163 if ( ! wp_delete_post( $post_id ) ) { |
147 wp_die( __('Error in deleting.') ); |
164 wp_die( __( 'Error in deleting.' ) ); |
|
165 } |
148 } |
166 } |
149 $deleted++; |
167 $deleted++; |
150 } |
168 } |
151 $sendback = add_query_arg('deleted', $deleted, $sendback); |
169 $sendback = add_query_arg( 'deleted', $deleted, $sendback ); |
152 break; |
170 break; |
153 case 'edit': |
171 case 'edit': |
154 if ( isset($_REQUEST['bulk_edit']) ) { |
172 if ( isset( $_REQUEST['bulk_edit'] ) ) { |
155 $done = bulk_edit_posts($_REQUEST); |
173 $done = bulk_edit_posts( $_REQUEST ); |
156 |
174 |
157 if ( is_array($done) ) { |
175 if ( is_array( $done ) ) { |
158 $done['updated'] = count( $done['updated'] ); |
176 $done['updated'] = count( $done['updated'] ); |
159 $done['skipped'] = count( $done['skipped'] ); |
177 $done['skipped'] = count( $done['skipped'] ); |
160 $done['locked'] = count( $done['locked'] ); |
178 $done['locked'] = count( $done['locked'] ); |
161 $sendback = add_query_arg( $done, $sendback ); |
179 $sendback = add_query_arg( $done, $sendback ); |
162 } |
180 } |
163 } |
181 } |
164 break; |
182 break; |
165 default: |
183 default: |
166 /** This action is documented in wp-admin/edit-comments.php */ |
184 /** This action is documented in wp-admin/edit-comments.php */ |
167 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids ); |
185 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids ); |
168 break; |
186 break; |
169 } |
187 } |
170 |
188 |
171 $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback ); |
189 $sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback ); |
172 |
190 |
173 wp_redirect($sendback); |
191 wp_redirect( $sendback ); |
174 exit(); |
192 exit(); |
175 } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) { |
193 } elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
176 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) ); |
194 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
177 exit; |
195 exit; |
178 } |
196 } |
179 |
197 |
180 $wp_list_table->prepare_items(); |
198 $wp_list_table->prepare_items(); |
181 |
199 |
182 wp_enqueue_script('inline-edit-post'); |
200 wp_enqueue_script( 'inline-edit-post' ); |
183 wp_enqueue_script('heartbeat'); |
201 wp_enqueue_script( 'heartbeat' ); |
|
202 |
|
203 if ( 'wp_block' === $post_type ) { |
|
204 wp_enqueue_script( 'wp-list-reusable-blocks' ); |
|
205 wp_enqueue_style( 'wp-list-reusable-blocks' ); |
|
206 } |
184 |
207 |
185 $title = $post_type_object->labels->name; |
208 $title = $post_type_object->labels->name; |
186 |
209 |
187 if ( 'post' == $post_type ) { |
210 if ( 'post' == $post_type ) { |
188 get_current_screen()->add_help_tab( array( |
211 get_current_screen()->add_help_tab( |
189 'id' => 'overview', |
212 array( |
190 'title' => __('Overview'), |
213 'id' => 'overview', |
191 'content' => |
214 'title' => __( 'Overview' ), |
192 '<p>' . __('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.') . '</p>' |
215 'content' => |
193 ) ); |
216 '<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>', |
194 get_current_screen()->add_help_tab( array( |
217 ) |
195 'id' => 'screen-content', |
218 ); |
196 'title' => __('Screen Content'), |
219 get_current_screen()->add_help_tab( |
197 'content' => |
220 array( |
198 '<p>' . __('You can customize the display of this screen’s contents in a number of ways:') . '</p>' . |
221 'id' => 'screen-content', |
199 '<ul>' . |
222 'title' => __( 'Screen Content' ), |
200 '<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' . |
223 'content' => |
201 '<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' . |
224 '<p>' . __( 'You can customize the display of this screen’s contents in a number of ways:' ) . '</p>' . |
202 '<li>' . __('You can view posts in a simple title list or with an excerpt using the Screen Options tab.') . '</li>' . |
225 '<ul>' . |
203 '<li>' . __('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.') . '</li>' . |
226 '<li>' . __( 'You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.' ) . '</li>' . |
204 '</ul>' |
227 '<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' . |
205 ) ); |
228 '<li>' . __( 'You can view posts in a simple title list or with an excerpt using the Screen Options tab.' ) . '</li>' . |
206 get_current_screen()->add_help_tab( array( |
229 '<li>' . __( 'You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.' ) . '</li>' . |
207 'id' => 'action-links', |
230 '</ul>', |
208 'title' => __('Available Actions'), |
231 ) |
209 'content' => |
232 ); |
210 '<p>' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '</p>' . |
233 get_current_screen()->add_help_tab( |
211 '<ul>' . |
234 array( |
212 '<li>' . __('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.') . '</li>' . |
235 'id' => 'action-links', |
213 '<li>' . __('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.') . '</li>' . |
236 'title' => __( 'Available Actions' ), |
214 '<li>' . __('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.') . '</li>' . |
237 'content' => |
215 '<li>' . __('<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post’s status.') . '</li>' . |
238 '<p>' . __( 'Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:' ) . '</p>' . |
216 '</ul>' |
239 '<ul>' . |
217 ) ); |
240 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.' ) . '</li>' . |
218 get_current_screen()->add_help_tab( array( |
241 '<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.' ) . '</li>' . |
219 'id' => 'bulk-actions', |
242 '<li>' . __( '<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.' ) . '</li>' . |
220 'title' => __('Bulk Actions'), |
243 '<li>' . __( '<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post’s status.' ) . '</li>' . |
221 'content' => |
244 '</ul>', |
222 '<p>' . __('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.') . '</p>' . |
245 ) |
223 '<p>' . __('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '</p>' |
246 ); |
224 ) ); |
247 get_current_screen()->add_help_tab( |
|
248 array( |
|
249 'id' => 'bulk-actions', |
|
250 'title' => __( 'Bulk Actions' ), |
|
251 'content' => |
|
252 '<p>' . __( 'You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.' ) . '</p>' . |
|
253 '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.' ) . '</p>', |
|
254 ) |
|
255 ); |
225 |
256 |
226 get_current_screen()->set_help_sidebar( |
257 get_current_screen()->set_help_sidebar( |
227 '<p><strong>' . __('For more information:') . '</strong></p>' . |
258 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
228 '<p>' . __('<a href="https://codex.wordpress.org/Posts_Screen">Documentation on Managing Posts</a>') . '</p>' . |
259 '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Screen">Documentation on Managing Posts</a>' ) . '</p>' . |
229 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
260 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
230 ); |
261 ); |
231 |
262 |
232 } elseif ( 'page' == $post_type ) { |
263 } elseif ( 'page' == $post_type ) { |
233 get_current_screen()->add_help_tab( array( |
264 get_current_screen()->add_help_tab( |
234 'id' => 'overview', |
265 array( |
235 'title' => __('Overview'), |
266 'id' => 'overview', |
236 'content' => |
267 'title' => __( 'Overview' ), |
237 '<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.') . '</p>' |
268 'content' => |
238 ) ); |
269 '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>', |
239 get_current_screen()->add_help_tab( array( |
270 ) |
240 'id' => 'managing-pages', |
271 ); |
241 'title' => __('Managing Pages'), |
272 get_current_screen()->add_help_tab( |
242 'content' => |
273 array( |
243 '<p>' . __('Managing pages is very similar to managing posts, and the screens can be customized in the same way.') . '</p>' . |
274 'id' => 'managing-pages', |
244 '<p>' . __('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.') . '</p>' |
275 'title' => __( 'Managing Pages' ), |
245 ) ); |
276 'content' => |
|
277 '<p>' . __( 'Managing pages is very similar to managing posts, and the screens can be customized in the same way.' ) . '</p>' . |
|
278 '<p>' . __( 'You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.' ) . '</p>', |
|
279 ) |
|
280 ); |
246 |
281 |
247 get_current_screen()->set_help_sidebar( |
282 get_current_screen()->set_help_sidebar( |
248 '<p><strong>' . __('For more information:') . '</strong></p>' . |
283 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
249 '<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen">Documentation on Managing Pages</a>') . '</p>' . |
284 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Screen">Documentation on Managing Pages</a>' ) . '</p>' . |
250 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
285 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
251 ); |
286 ); |
252 |
287 |
253 } |
288 } |
254 |
289 |
255 get_current_screen()->set_screen_reader_content( array( |
290 get_current_screen()->set_screen_reader_content( |
256 'heading_views' => $post_type_object->labels->filter_items_list, |
291 array( |
257 'heading_pagination' => $post_type_object->labels->items_list_navigation, |
292 'heading_views' => $post_type_object->labels->filter_items_list, |
258 'heading_list' => $post_type_object->labels->items_list, |
293 'heading_pagination' => $post_type_object->labels->items_list_navigation, |
259 ) ); |
294 'heading_list' => $post_type_object->labels->items_list, |
260 |
295 ) |
261 add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) ); |
296 ); |
|
297 |
|
298 add_screen_option( |
|
299 'per_page', |
|
300 array( |
|
301 'default' => 20, |
|
302 'option' => 'edit_' . $post_type . '_per_page', |
|
303 ) |
|
304 ); |
262 |
305 |
263 $bulk_counts = array( |
306 $bulk_counts = array( |
264 'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0, |
307 'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0, |
265 'locked' => isset( $_REQUEST['locked'] ) ? absint( $_REQUEST['locked'] ) : 0, |
308 'locked' => isset( $_REQUEST['locked'] ) ? absint( $_REQUEST['locked'] ) : 0, |
266 'deleted' => isset( $_REQUEST['deleted'] ) ? absint( $_REQUEST['deleted'] ) : 0, |
309 'deleted' => isset( $_REQUEST['deleted'] ) ? absint( $_REQUEST['deleted'] ) : 0, |
267 'trashed' => isset( $_REQUEST['trashed'] ) ? absint( $_REQUEST['trashed'] ) : 0, |
310 'trashed' => isset( $_REQUEST['trashed'] ) ? absint( $_REQUEST['trashed'] ) : 0, |
268 'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0, |
311 'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0, |
269 ); |
312 ); |
270 |
313 |
271 $bulk_messages = array(); |
314 $bulk_messages = array(); |
272 $bulk_messages['post'] = array( |
315 $bulk_messages['post'] = array( |
273 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), |
316 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), |
274 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) : |
317 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) : |
275 _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), |
318 _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), |
276 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), |
319 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), |
277 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), |
320 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), |
278 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), |
321 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), |
279 ); |
322 ); |
280 $bulk_messages['page'] = array( |
323 $bulk_messages['page'] = array( |
281 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), |
324 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), |
282 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) : |
325 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) : |
283 _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), |
326 _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), |
284 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), |
327 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), |
285 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), |
328 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), |
286 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), |
329 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), |
|
330 ); |
|
331 $bulk_messages['wp_block'] = array( |
|
332 'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ), |
|
333 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) : _n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ), |
|
334 'deleted' => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ), |
|
335 'trashed' => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ), |
|
336 'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ), |
287 ); |
337 ); |
288 |
338 |
289 /** |
339 /** |
290 * Filters the bulk action updated messages. |
340 * Filters the bulk action updated messages. |
291 * |
341 * |
292 * By default, custom post types use the messages for the 'post' post type. |
342 * By default, custom post types use the messages for the 'post' post type. |
293 * |
343 * |
294 * @since 3.7.0 |
344 * @since 3.7.0 |
295 * |
345 * |
296 * @param array $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are |
346 * @param array[] $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are |
297 * keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'. |
347 * keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'. |
298 * @param array $bulk_counts Array of item counts for each message, used to build internationalized strings. |
348 * @param int[] $bulk_counts Array of item counts for each message, used to build internationalized strings. |
299 */ |
349 */ |
300 $bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts ); |
350 $bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts ); |
301 $bulk_counts = array_filter( $bulk_counts ); |
351 $bulk_counts = array_filter( $bulk_counts ); |
302 |
352 |
303 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
353 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
304 ?> |
354 ?> |
305 <div class="wrap"> |
355 <div class="wrap"> |
306 <h1 class="wp-heading-inline"><?php |
356 <h1 class="wp-heading-inline"> |
|
357 <?php |
307 echo esc_html( $post_type_object->labels->name ); |
358 echo esc_html( $post_type_object->labels->name ); |
308 ?></h1> |
359 ?> |
|
360 </h1> |
309 |
361 |
310 <?php |
362 <?php |
311 if ( current_user_can( $post_type_object->cap->create_posts ) ) { |
363 if ( current_user_can( $post_type_object->cap->create_posts ) ) { |
312 echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
364 echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
313 } |
365 } |