101 $viewable = is_post_type_viewable( $post_type_object ); |
114 $viewable = is_post_type_viewable( $post_type_object ); |
102 |
115 |
103 if ( $viewable ) { |
116 if ( $viewable ) { |
104 |
117 |
105 // Preview post link. |
118 // Preview post link. |
106 $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
119 $preview_post_link_html = sprintf( |
|
120 ' <a target="_blank" href="%1$s">%2$s</a>', |
107 esc_url( $preview_url ), |
121 esc_url( $preview_url ), |
108 __( 'Preview post' ) |
122 __( 'Preview post' ) |
109 ); |
123 ); |
110 |
124 |
111 // Scheduled post preview link. |
125 // Scheduled post preview link. |
112 $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
126 $scheduled_post_link_html = sprintf( |
|
127 ' <a target="_blank" href="%1$s">%2$s</a>', |
113 esc_url( $permalink ), |
128 esc_url( $permalink ), |
114 __( 'Preview post' ) |
129 __( 'Preview post' ) |
115 ); |
130 ); |
116 |
131 |
117 // View post link. |
132 // View post link. |
118 $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>', |
133 $view_post_link_html = sprintf( |
|
134 ' <a href="%1$s">%2$s</a>', |
119 esc_url( $permalink ), |
135 esc_url( $permalink ), |
120 __( 'View post' ) |
136 __( 'View post' ) |
121 ); |
137 ); |
122 |
138 |
123 // Preview page link. |
139 // Preview page link. |
124 $preview_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
140 $preview_page_link_html = sprintf( |
|
141 ' <a target="_blank" href="%1$s">%2$s</a>', |
125 esc_url( $preview_url ), |
142 esc_url( $preview_url ), |
126 __( 'Preview page' ) |
143 __( 'Preview page' ) |
127 ); |
144 ); |
128 |
145 |
129 // Scheduled page preview link. |
146 // Scheduled page preview link. |
130 $scheduled_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
147 $scheduled_page_link_html = sprintf( |
|
148 ' <a target="_blank" href="%1$s">%2$s</a>', |
131 esc_url( $permalink ), |
149 esc_url( $permalink ), |
132 __( 'Preview page' ) |
150 __( 'Preview page' ) |
133 ); |
151 ); |
134 |
152 |
135 // View page link. |
153 // View page link. |
136 $view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>', |
154 $view_page_link_html = sprintf( |
|
155 ' <a href="%1$s">%2$s</a>', |
137 esc_url( $permalink ), |
156 esc_url( $permalink ), |
138 __( 'View page' ) |
157 __( 'View page' ) |
139 ); |
158 ); |
140 |
159 |
141 } |
160 } |
142 |
161 |
143 /* translators: Publish box date format, see https://secure.php.net/date */ |
162 /* translators: Publish box date format, see https://secure.php.net/date */ |
144 $scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ); |
163 $scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ); |
145 |
164 |
146 $messages['post'] = array( |
165 $messages['post'] = array( |
147 0 => '', // Unused. Messages start at index 1. |
166 0 => '', // Unused. Messages start at index 1. |
148 1 => __( 'Post updated.' ) . $view_post_link_html, |
167 1 => __( 'Post updated.' ) . $view_post_link_html, |
149 2 => __( 'Custom field updated.' ), |
168 2 => __( 'Custom field updated.' ), |
150 3 => __( 'Custom field deleted.' ), |
169 3 => __( 'Custom field deleted.' ), |
151 4 => __( 'Post updated.' ), |
170 4 => __( 'Post updated.' ), |
152 /* translators: %s: date and time of the revision */ |
171 /* translators: %s: date and time of the revision */ |
153 5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
172 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
154 6 => __( 'Post published.' ) . $view_post_link_html, |
173 6 => __( 'Post published.' ) . $view_post_link_html, |
155 7 => __( 'Post saved.' ), |
174 7 => __( 'Post saved.' ), |
156 8 => __( 'Post submitted.' ) . $preview_post_link_html, |
175 8 => __( 'Post submitted.' ) . $preview_post_link_html, |
157 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html, |
176 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html, |
158 10 => __( 'Post draft updated.' ) . $preview_post_link_html, |
177 10 => __( 'Post draft updated.' ) . $preview_post_link_html, |
159 ); |
178 ); |
160 $messages['page'] = array( |
179 $messages['page'] = array( |
161 0 => '', // Unused. Messages start at index 1. |
180 0 => '', // Unused. Messages start at index 1. |
162 1 => __( 'Page updated.' ) . $view_page_link_html, |
181 1 => __( 'Page updated.' ) . $view_page_link_html, |
163 2 => __( 'Custom field updated.' ), |
182 2 => __( 'Custom field updated.' ), |
164 3 => __( 'Custom field deleted.' ), |
183 3 => __( 'Custom field deleted.' ), |
165 4 => __( 'Page updated.' ), |
184 4 => __( 'Page updated.' ), |
166 /* translators: %s: date and time of the revision */ |
185 /* translators: %s: date and time of the revision */ |
167 5 => isset($_GET['revision']) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
186 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
168 6 => __( 'Page published.' ) . $view_page_link_html, |
187 6 => __( 'Page published.' ) . $view_page_link_html, |
169 7 => __( 'Page saved.' ), |
188 7 => __( 'Page saved.' ), |
170 8 => __( 'Page submitted.' ) . $preview_page_link_html, |
189 8 => __( 'Page submitted.' ) . $preview_page_link_html, |
171 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html, |
190 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html, |
172 10 => __( 'Page draft updated.' ) . $preview_page_link_html, |
191 10 => __( 'Page draft updated.' ) . $preview_page_link_html, |
173 ); |
192 ); |
174 $messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now. |
193 $messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now. |
175 |
194 |
176 /** |
195 /** |
177 * Filters the post updated messages. |
196 * Filters the post updated messages. |
178 * |
197 * |
179 * @since 3.0.0 |
198 * @since 3.0.0 |
180 * |
199 * |
181 * @param array $messages Post updated messages. For defaults @see $messages declarations above. |
200 * @param array[] $messages Post updated messages. For defaults see `$messages` declarations above. |
182 */ |
201 */ |
183 $messages = apply_filters( 'post_updated_messages', $messages ); |
202 $messages = apply_filters( 'post_updated_messages', $messages ); |
184 |
203 |
185 $message = false; |
204 $message = false; |
186 if ( isset($_GET['message']) ) { |
205 if ( isset( $_GET['message'] ) ) { |
187 $_GET['message'] = absint( $_GET['message'] ); |
206 $_GET['message'] = absint( $_GET['message'] ); |
188 if ( isset($messages[$post_type][$_GET['message']]) ) |
207 if ( isset( $messages[ $post_type ][ $_GET['message'] ] ) ) { |
189 $message = $messages[$post_type][$_GET['message']]; |
208 $message = $messages[ $post_type ][ $_GET['message'] ]; |
190 elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) |
209 } elseif ( ! isset( $messages[ $post_type ] ) && isset( $messages['post'][ $_GET['message'] ] ) ) { |
191 $message = $messages['post'][$_GET['message']]; |
210 $message = $messages['post'][ $_GET['message'] ]; |
192 } |
211 } |
193 |
212 } |
194 $notice = false; |
213 |
|
214 $notice = false; |
195 $form_extra = ''; |
215 $form_extra = ''; |
196 if ( 'auto-draft' == $post->post_status ) { |
216 if ( 'auto-draft' == $post->post_status ) { |
197 if ( 'edit' == $action ) |
217 if ( 'edit' == $action ) { |
198 $post->post_title = ''; |
218 $post->post_title = ''; |
199 $autosave = false; |
219 } |
|
220 $autosave = false; |
200 $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
221 $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
201 } else { |
222 } else { |
202 $autosave = wp_get_post_autosave( $post_ID ); |
223 $autosave = wp_get_post_autosave( $post_ID ); |
203 } |
224 } |
204 |
225 |
205 $form_action = 'editpost'; |
226 $form_action = 'editpost'; |
206 $nonce_action = 'update-post_' . $post_ID; |
227 $nonce_action = 'update-post_' . $post_ID; |
207 $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />"; |
228 $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />"; |
208 |
229 |
209 // Detect if there exists an autosave newer than the post and if that autosave is different than the post |
230 // Detect if there exists an autosave newer than the post and if that autosave is different than the post |
210 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { |
231 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { |
211 foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { |
232 foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { |
212 if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { |
233 if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { |
213 $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); |
234 $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); |
214 break; |
235 break; |
215 } |
236 } |
216 } |
237 } |
217 // If this autosave isn't different from the current post, begone. |
238 // If this autosave isn't different from the current post, begone. |
218 if ( ! $notice ) |
239 if ( ! $notice ) { |
219 wp_delete_post_revision( $autosave->ID ); |
240 wp_delete_post_revision( $autosave->ID ); |
220 unset($autosave_field, $_autosave_field); |
241 } |
221 } |
242 unset( $autosave_field, $_autosave_field ); |
222 |
243 } |
223 $post_type_object = get_post_type_object($post_type); |
244 |
|
245 $post_type_object = get_post_type_object( $post_type ); |
224 |
246 |
225 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). |
247 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). |
226 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
248 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
227 |
249 |
228 |
250 register_and_do_post_meta_boxes( $post ); |
229 $publish_callback_args = null; |
251 |
230 if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) { |
252 add_screen_option( |
231 $revisions = wp_get_post_revisions( $post_ID ); |
253 'layout_columns', |
232 |
254 array( |
233 // We should aim to show the revisions meta box only when there are revisions. |
255 'max' => 2, |
234 if ( count( $revisions ) > 1 ) { |
256 'default' => 2, |
235 reset( $revisions ); // Reset pointer for key() |
257 ) |
236 $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) ); |
258 ); |
237 add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core'); |
|
238 } |
|
239 } |
|
240 |
|
241 if ( 'attachment' == $post_type ) { |
|
242 wp_enqueue_script( 'image-edit' ); |
|
243 wp_enqueue_style( 'imgareaselect' ); |
|
244 add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); |
|
245 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); |
|
246 |
|
247 if ( wp_attachment_is( 'audio', $post ) ) { |
|
248 add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' ); |
|
249 } |
|
250 } else { |
|
251 add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); |
|
252 } |
|
253 |
|
254 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) |
|
255 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); |
|
256 |
|
257 // all taxonomies |
|
258 foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
|
259 $taxonomy = get_taxonomy( $tax_name ); |
|
260 if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) |
|
261 continue; |
|
262 |
|
263 $label = $taxonomy->labels->name; |
|
264 |
|
265 if ( ! is_taxonomy_hierarchical( $tax_name ) ) |
|
266 $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
267 else |
|
268 $tax_meta_box_id = $tax_name . 'div'; |
|
269 |
|
270 add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); |
|
271 } |
|
272 |
|
273 if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) { |
|
274 add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core' ); |
|
275 } |
|
276 |
|
277 if ( $thumbnail_support && current_user_can( 'upload_files' ) ) |
|
278 add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low'); |
|
279 |
|
280 if ( post_type_supports($post_type, 'excerpt') ) |
|
281 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); |
|
282 |
|
283 if ( post_type_supports($post_type, 'trackbacks') ) |
|
284 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); |
|
285 |
|
286 if ( post_type_supports($post_type, 'custom-fields') ) |
|
287 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); |
|
288 |
|
289 /** |
|
290 * Fires in the middle of built-in meta box registration. |
|
291 * |
|
292 * @since 2.1.0 |
|
293 * @deprecated 3.7.0 Use 'add_meta_boxes' instead. |
|
294 * |
|
295 * @param WP_Post $post Post object. |
|
296 */ |
|
297 do_action( 'dbx_post_advanced', $post ); |
|
298 |
|
299 // Allow the Discussion meta box to show up if the post type supports comments, |
|
300 // or if comments or pings are open. |
|
301 if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { |
|
302 add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' ); |
|
303 } |
|
304 |
|
305 $stati = get_post_stati( array( 'public' => true ) ); |
|
306 if ( empty( $stati ) ) { |
|
307 $stati = array( 'publish' ); |
|
308 } |
|
309 $stati[] = 'private'; |
|
310 |
|
311 if ( in_array( get_post_status( $post ), $stati ) ) { |
|
312 // If the post type support comments, or the post has comments, allow the |
|
313 // Comments meta box. |
|
314 if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { |
|
315 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' ); |
|
316 } |
|
317 } |
|
318 |
|
319 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) |
|
320 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); |
|
321 |
|
322 if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
|
323 add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core' ); |
|
324 } |
|
325 |
|
326 /** |
|
327 * Fires after all built-in meta boxes have been added. |
|
328 * |
|
329 * @since 3.0.0 |
|
330 * |
|
331 * @param string $post_type Post type. |
|
332 * @param WP_Post $post Post object. |
|
333 */ |
|
334 do_action( 'add_meta_boxes', $post_type, $post ); |
|
335 |
|
336 /** |
|
337 * Fires after all built-in meta boxes have been added, contextually for the given post type. |
|
338 * |
|
339 * The dynamic portion of the hook, `$post_type`, refers to the post type of the post. |
|
340 * |
|
341 * @since 3.0.0 |
|
342 * |
|
343 * @param WP_Post $post Post object. |
|
344 */ |
|
345 do_action( "add_meta_boxes_{$post_type}", $post ); |
|
346 |
|
347 /** |
|
348 * Fires after meta boxes have been added. |
|
349 * |
|
350 * Fires once for each of the default meta box contexts: normal, advanced, and side. |
|
351 * |
|
352 * @since 3.0.0 |
|
353 * |
|
354 * @param string $post_type Post type of the post. |
|
355 * @param string $context string Meta box context. |
|
356 * @param WP_Post $post Post object. |
|
357 */ |
|
358 do_action( 'do_meta_boxes', $post_type, 'normal', $post ); |
|
359 /** This action is documented in wp-admin/edit-form-advanced.php */ |
|
360 do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); |
|
361 /** This action is documented in wp-admin/edit-form-advanced.php */ |
|
362 do_action( 'do_meta_boxes', $post_type, 'side', $post ); |
|
363 |
|
364 add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
|
365 |
259 |
366 if ( 'post' == $post_type ) { |
260 if ( 'post' == $post_type ) { |
367 $customize_display = '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>'; |
261 $customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>'; |
368 |
262 |
369 get_current_screen()->add_help_tab( array( |
263 get_current_screen()->add_help_tab( |
370 'id' => 'customize-display', |
264 array( |
371 'title' => __('Customizing This Display'), |
265 'id' => 'customize-display', |
372 'content' => $customize_display, |
266 'title' => __( 'Customizing This Display' ), |
373 ) ); |
267 'content' => $customize_display, |
374 |
268 ) |
375 $title_and_editor = '<p>' . __('<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '</p>'; |
269 ); |
|
270 |
|
271 $title_and_editor = '<p>' . __( '<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.' ) . '</p>'; |
376 $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>'; |
272 $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>'; |
377 $title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls.' ) . '</p>'; |
273 $title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls.' ) . '</p>'; |
378 $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>'; |
274 $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>'; |
379 $title_and_editor .= '<p>' . __( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>'; |
275 $title_and_editor .= '<p>' . __( 'You can insert media files by clicking the button above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>'; |
380 $title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>'; |
276 $title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>'; |
381 $title_and_editor .= '<p>' . __( 'Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>'; |
277 $title_and_editor .= '<p>' . __( 'Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>'; |
382 |
278 |
383 get_current_screen()->add_help_tab( array( |
279 get_current_screen()->add_help_tab( |
384 'id' => 'title-post-editor', |
280 array( |
385 'title' => __('Title and Post Editor'), |
281 'id' => 'title-post-editor', |
386 'content' => $title_and_editor, |
282 'title' => __( 'Title and Post Editor' ), |
387 ) ); |
283 'content' => $title_and_editor, |
|
284 ) |
|
285 ); |
388 |
286 |
389 get_current_screen()->set_help_sidebar( |
287 get_current_screen()->set_help_sidebar( |
390 '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php') . '</p>' . |
288 '<p>' . sprintf( __( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ), 'tools.php' ) . '</p>' . |
391 '<p><strong>' . __('For more information:') . '</strong></p>' . |
289 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
392 '<p>' . __('<a href="https://codex.wordpress.org/Posts_Add_New_Screen">Documentation on Writing and Editing Posts</a>') . '</p>' . |
290 '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Add_New_Screen">Documentation on Writing and Editing Posts</a>' ) . '</p>' . |
393 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
291 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
394 ); |
292 ); |
395 } elseif ( 'page' == $post_type ) { |
293 } elseif ( 'page' == $post_type ) { |
396 $about_pages = '<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>' . |
294 $about_pages = '<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>' . |
397 '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.') . '</p>'; |
295 '<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>'; |
398 |
296 |
399 get_current_screen()->add_help_tab( array( |
297 get_current_screen()->add_help_tab( |
400 'id' => 'about-pages', |
298 array( |
401 'title' => __('About Pages'), |
299 'id' => 'about-pages', |
402 'content' => $about_pages, |
300 'title' => __( 'About Pages' ), |
403 ) ); |
301 'content' => $about_pages, |
|
302 ) |
|
303 ); |
404 |
304 |
405 get_current_screen()->set_help_sidebar( |
305 get_current_screen()->set_help_sidebar( |
406 '<p><strong>' . __('For more information:') . '</strong></p>' . |
306 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
407 '<p>' . __('<a href="https://codex.wordpress.org/Pages_Add_New_Screen">Documentation on Adding New Pages</a>') . '</p>' . |
307 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Add_New_Screen">Documentation on Adding New Pages</a>' ) . '</p>' . |
408 '<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages">Documentation on Editing Pages</a>') . '</p>' . |
308 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages">Documentation on Editing Pages</a>' ) . '</p>' . |
409 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
309 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
410 ); |
310 ); |
411 } elseif ( 'attachment' == $post_type ) { |
311 } elseif ( 'attachment' == $post_type ) { |
412 get_current_screen()->add_help_tab( array( |
312 get_current_screen()->add_help_tab( |
413 'id' => 'overview', |
313 array( |
414 'title' => __('Overview'), |
314 'id' => 'overview', |
415 'content' => |
315 'title' => __( 'Overview' ), |
416 '<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' . |
316 'content' => |
417 '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
317 '<p>' . __( 'This screen allows you to edit four fields for metadata in a file within the media library.' ) . '</p>' . |
418 '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
318 '<p>' . __( 'For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.' ) . '</p>' . |
419 '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
319 '<p>' . __( 'Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.' ) . '</p>' . |
420 ) ); |
320 '<p>' . __( 'Remember to click Update Media to save metadata entered or changed.' ) . '</p>', |
|
321 ) |
|
322 ); |
421 |
323 |
422 get_current_screen()->set_help_sidebar( |
324 get_current_screen()->set_help_sidebar( |
423 '<p><strong>' . __('For more information:') . '</strong></p>' . |
325 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
424 '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>') . '</p>' . |
326 '<p>' . __( '<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>' ) . '</p>' . |
425 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
327 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
426 ); |
328 ); |
427 } |
329 } |
428 |
330 |
429 if ( 'post' == $post_type || 'page' == $post_type ) { |
331 if ( 'post' == $post_type || 'page' == $post_type ) { |
430 $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>'; |
332 $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>'; |
431 $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>'; |
333 $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>'; |
432 |
334 |
433 get_current_screen()->add_help_tab( array( |
335 get_current_screen()->add_help_tab( |
434 'id' => 'inserting-media', |
336 array( |
435 'title' => __( 'Inserting Media' ), |
337 'id' => 'inserting-media', |
436 'content' => $inserting_media, |
338 'title' => __( 'Inserting Media' ), |
437 ) ); |
339 'content' => $inserting_media, |
|
340 ) |
|
341 ); |
438 } |
342 } |
439 |
343 |
440 if ( 'post' == $post_type ) { |
344 if ( 'post' == $post_type ) { |
441 $publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>'; |
345 $publish_box = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>'; |
442 $publish_box .= '<ul><li>' . |
346 $publish_box .= '<ul><li>' . |
443 __( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) . |
347 __( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) . |
444 '</li>'; |
348 '</li>'; |
445 |
349 |
446 if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) { |
350 if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) { |
452 $publish_box .= '<li>' . sprintf( __( '<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html( $post_type_object->labels->featured_image ) ) . '</li>'; |
356 $publish_box .= '<li>' . sprintf( __( '<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html( $post_type_object->labels->featured_image ) ) . '</li>'; |
453 } |
357 } |
454 |
358 |
455 $publish_box .= '</ul>'; |
359 $publish_box .= '</ul>'; |
456 |
360 |
457 get_current_screen()->add_help_tab( array( |
361 get_current_screen()->add_help_tab( |
458 'id' => 'publish-box', |
362 array( |
459 'title' => __('Publish Settings'), |
363 'id' => 'publish-box', |
460 'content' => $publish_box, |
364 'title' => __( 'Publish Settings' ), |
461 ) ); |
365 'content' => $publish_box, |
462 |
366 ) |
463 $discussion_settings = '<p>' . __('<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>'; |
367 ); |
464 $discussion_settings .= '<p>' . __('<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>'; |
368 |
465 |
369 $discussion_settings = '<p>' . __( '<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.' ) . '</p>'; |
466 get_current_screen()->add_help_tab( array( |
370 $discussion_settings .= '<p>' . __( '<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.' ) . '</p>'; |
467 'id' => 'discussion-settings', |
371 |
468 'title' => __('Discussion Settings'), |
372 get_current_screen()->add_help_tab( |
469 'content' => $discussion_settings, |
373 array( |
470 ) ); |
374 'id' => 'discussion-settings', |
|
375 'title' => __( 'Discussion Settings' ), |
|
376 'content' => $discussion_settings, |
|
377 ) |
|
378 ); |
471 } elseif ( 'page' == $post_type ) { |
379 } elseif ( 'page' == $post_type ) { |
472 $page_attributes = '<p>' . __('<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . |
380 $page_attributes = '<p>' . __( '<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' . |
473 '<p>' . __('<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' . |
381 '<p>' . __( '<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.' ) . '</p>' . |
474 '<p>' . __('<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>'; |
382 '<p>' . __( '<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '</p>'; |
475 |
383 |
476 get_current_screen()->add_help_tab( array( |
384 get_current_screen()->add_help_tab( |
477 'id' => 'page-attributes', |
385 array( |
478 'title' => __('Page Attributes'), |
386 'id' => 'page-attributes', |
479 'content' => $page_attributes, |
387 'title' => __( 'Page Attributes' ), |
480 ) ); |
388 'content' => $page_attributes, |
|
389 ) |
|
390 ); |
481 } |
391 } |
482 |
392 |
483 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
393 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
484 ?> |
394 ?> |
485 |
395 |
486 <div class="wrap"> |
396 <div class="wrap"> |
487 <h1 class="wp-heading-inline"><?php |
397 <h1 class="wp-heading-inline"> |
|
398 <?php |
488 echo esc_html( $title ); |
399 echo esc_html( $title ); |
489 ?></h1> |
400 ?> |
|
401 </h1> |
490 |
402 |
491 <?php |
403 <?php |
492 if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) { |
404 if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) { |
493 echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
405 echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
494 } |
406 } |
495 ?> |
407 ?> |
496 |
408 |
497 <hr class="wp-header-end"> |
409 <hr class="wp-header-end"> |
498 |
410 |
499 <?php if ( $notice ) : ?> |
411 <?php if ( $notice ) : ?> |
500 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div> |
412 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice; ?></p></div> |
501 <?php endif; ?> |
413 <?php endif; ?> |
502 <?php if ( $message ) : ?> |
414 <?php if ( $message ) : ?> |
503 <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div> |
415 <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div> |
504 <?php endif; ?> |
416 <?php endif; ?> |
505 <div id="lost-connection-notice" class="error hidden"> |
417 <div id="lost-connection-notice" class="error hidden"> |
506 <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.' ); ?> |
418 <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.' ); ?> |
507 <span class="hide-if-no-sessionstorage"><?php _e( 'We’re backing up this post in your browser, just in case.' ); ?></span> |
419 <span class="hide-if-no-sessionstorage"><?php _e( 'We’re backing up this post in your browser, just in case.' ); ?></span> |
508 </p> |
420 </p> |
509 </div> |
421 </div> |
510 <form name="post" action="post.php" method="post" id="post"<?php |
422 <form name="post" action="post.php" method="post" id="post" |
|
423 <?php |
511 /** |
424 /** |
512 * Fires inside the post editor form tag. |
425 * Fires inside the post editor form tag. |
513 * |
426 * |
514 * @since 3.0.0 |
427 * @since 3.0.0 |
515 * |
428 * |
516 * @param WP_Post $post Post object. |
429 * @param WP_Post $post Post object. |
517 */ |
430 */ |
518 do_action( 'post_edit_form_tag', $post ); |
431 do_action( 'post_edit_form_tag', $post ); |
519 |
432 |
520 $referer = wp_get_referer(); |
433 $referer = wp_get_referer(); |
521 ?>> |
434 ?> |
522 <?php wp_nonce_field($nonce_action); ?> |
435 > |
523 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> |
436 <?php wp_nonce_field( $nonce_action ); ?> |
524 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" /> |
437 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID; ?>" /> |
525 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" /> |
438 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ); ?>" /> |
|
439 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" /> |
526 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
440 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
527 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" /> |
441 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> |
528 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" /> |
442 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" /> |
529 <input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> |
443 <input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> |
530 <?php if ( ! empty( $active_post_lock ) ) { ?> |
444 <?php if ( ! empty( $active_post_lock ) ) { ?> |
531 <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> |
445 <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> |
532 <?php |
446 <?php |
533 } |
447 } |
534 if ( 'draft' != get_post_status( $post ) ) |
448 if ( 'draft' != get_post_status( $post ) ) { |
535 wp_original_referer_field(true, 'previous'); |
449 wp_original_referer_field( true, 'previous' ); |
|
450 } |
536 |
451 |
537 echo $form_extra; |
452 echo $form_extra; |
538 |
453 |
539 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
454 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
540 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
455 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
548 * |
463 * |
549 * @since 3.7.0 |
464 * @since 3.7.0 |
550 * |
465 * |
551 * @param WP_Post $post Post object. |
466 * @param WP_Post $post Post object. |
552 */ |
467 */ |
553 do_action( 'edit_form_top', $post ); ?> |
468 do_action( 'edit_form_top', $post ); |
|
469 ?> |
554 |
470 |
555 <div id="poststuff"> |
471 <div id="poststuff"> |
556 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
472 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
557 <div id="post-body-content"> |
473 <div id="post-body-content"> |
558 |
474 |
559 <?php if ( post_type_supports($post_type, 'title') ) { ?> |
475 <?php if ( post_type_supports( $post_type, 'title' ) ) { ?> |
560 <div id="titlediv"> |
476 <div id="titlediv"> |
561 <div id="titlewrap"> |
477 <div id="titlewrap"> |
562 <?php |
478 <?php |
563 /** |
479 /** |
564 * Filters the title field placeholder text. |
480 * Filters the title field placeholder text. |
565 * |
481 * |
566 * @since 3.1.0 |
482 * @since 3.1.0 |
567 * |
483 * |
568 * @param string $text Placeholder text. Default 'Enter title here'. |
484 * @param string $text Placeholder text. Default 'Add title'. |
569 * @param WP_Post $post Post object. |
485 * @param WP_Post $post Post object. |
570 */ |
486 */ |
571 $title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); |
487 $title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post ); |
572 ?> |
488 ?> |
573 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label> |
489 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label> |
574 <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" /> |
490 <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" /> |
575 </div> |
491 </div> |
576 <?php |
492 <?php |
577 /** |
493 /** |
578 * Fires before the permalink field in the edit form. |
494 * Fires before the permalink field in the edit form. |
579 * |
495 * |
580 * @since 4.1.0 |
496 * @since 4.1.0 |
|
497 * |
|
498 * @param WP_Post $post Post object. |
|
499 */ |
|
500 do_action( 'edit_form_before_permalink', $post ); |
|
501 ?> |
|
502 <div class="inside"> |
|
503 <?php |
|
504 if ( $viewable ) : |
|
505 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : ''; |
|
506 |
|
507 // As of 4.4, the Get Shortlink button is hidden by default. |
|
508 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { |
|
509 $shortlink = wp_get_shortlink( $post->ID, 'post' ); |
|
510 |
|
511 if ( ! empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url( '?page_id=' . $post->ID ) ) { |
|
512 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>'; |
|
513 } |
|
514 } |
|
515 |
|
516 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
|
517 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; |
|
518 ?> |
|
519 <div id="edit-slug-box" class="hide-if-no-js"> |
|
520 <?php |
|
521 if ( $has_sample_permalink ) { |
|
522 echo $sample_permalink_html; |
|
523 } |
|
524 ?> |
|
525 </div> |
|
526 <?php |
|
527 } |
|
528 endif; |
|
529 ?> |
|
530 </div> |
|
531 <?php |
|
532 wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); |
|
533 ?> |
|
534 </div><!-- /titlediv --> |
|
535 <?php |
|
536 } |
|
537 /** |
|
538 * Fires after the title field. |
|
539 * |
|
540 * @since 3.5.0 |
581 * |
541 * |
582 * @param WP_Post $post Post object. |
542 * @param WP_Post $post Post object. |
583 */ |
543 */ |
584 do_action( 'edit_form_before_permalink', $post ); |
544 do_action( 'edit_form_after_title', $post ); |
585 ?> |
545 |
586 <div class="inside"> |
546 if ( post_type_supports( $post_type, 'editor' ) ) { |
587 <?php |
547 $_wp_editor_expand_class = ''; |
588 if ( $viewable ) : |
548 if ( $_wp_editor_expand ) { |
589 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; |
549 $_wp_editor_expand_class = ' wp-editor-expand'; |
590 |
550 } |
591 // As of 4.4, the Get Shortlink button is hidden by default. |
|
592 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { |
|
593 $shortlink = wp_get_shortlink($post->ID, 'post'); |
|
594 |
|
595 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) { |
|
596 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>'; |
|
597 } |
|
598 } |
|
599 |
|
600 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
|
601 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; |
|
602 ?> |
|
603 <div id="edit-slug-box" class="hide-if-no-js"> |
|
604 <?php |
|
605 if ( $has_sample_permalink ) |
|
606 echo $sample_permalink_html; |
|
607 ?> |
551 ?> |
608 </div> |
552 <div id="postdivrich" class="postarea<?php echo $_wp_editor_expand_class; ?>"> |
609 <?php |
553 |
610 } |
554 <?php |
611 endif; |
555 wp_editor( |
612 ?> |
556 $post->post_content, |
613 </div> |
557 'content', |
614 <?php |
558 array( |
615 wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); |
559 '_content_editor_dfw' => $_content_editor_dfw, |
616 ?> |
560 'drag_drop_upload' => true, |
617 </div><!-- /titlediv --> |
561 'tabfocus_elements' => 'content-html,save-post', |
618 <?php |
562 'editor_height' => 300, |
619 } |
563 'tinymce' => array( |
620 /** |
564 'resize' => false, |
621 * Fires after the title field. |
565 'wp_autoresize_on' => $_wp_editor_expand, |
622 * |
566 'add_unload_trigger' => false, |
623 * @since 3.5.0 |
567 'wp_keep_scroll_position' => ! $is_IE, |
624 * |
568 ), |
625 * @param WP_Post $post Post object. |
569 ) |
626 */ |
570 ); |
627 do_action( 'edit_form_after_title', $post ); |
571 ?> |
628 |
|
629 if ( post_type_supports($post_type, 'editor') ) { |
|
630 ?> |
|
631 <div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>"> |
|
632 |
|
633 <?php wp_editor( $post->post_content, 'content', array( |
|
634 '_content_editor_dfw' => $_content_editor_dfw, |
|
635 'drag_drop_upload' => true, |
|
636 'tabfocus_elements' => 'content-html,save-post', |
|
637 'editor_height' => 300, |
|
638 'tinymce' => array( |
|
639 'resize' => false, |
|
640 'wp_autoresize_on' => $_wp_editor_expand, |
|
641 'add_unload_trigger' => false, |
|
642 'wp_keep_scroll_position' => ! $is_IE, |
|
643 ), |
|
644 ) ); ?> |
|
645 <table id="post-status-info"><tbody><tr> |
572 <table id="post-status-info"><tbody><tr> |
646 <td id="wp-word-count" class="hide-if-no-js"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> |
573 <td id="wp-word-count" class="hide-if-no-js"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> |
647 <td class="autosave-info"> |
574 <td class="autosave-info"> |
648 <span class="autosave-message"> </span> |
575 <span class="autosave-message"> </span> |
649 <?php |
576 <?php |
650 if ( 'auto-draft' != $post->post_status ) { |
577 if ( 'auto-draft' != $post->post_status ) { |
651 echo '<span id="last-edit">'; |
578 echo '<span id="last-edit">'; |
652 if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { |
579 if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { |
653 /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */ |
580 /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */ |
654 printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); |
581 printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); |
655 } else { |
582 } else { |
656 /* translators: 1: Post edited date, 2: Post edited time */ |
583 /* translators: 1: Post edited date, 2: Post edited time */ |
657 printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); |
584 printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); |
658 } |
585 } |
659 echo '</span>'; |
586 echo '</span>'; |
660 } ?> |
587 } |
|
588 ?> |
661 </td> |
589 </td> |
662 <td id="content-resize-handle" class="hide-if-no-js"><br /></td> |
590 <td id="content-resize-handle" class="hide-if-no-js"><br /></td> |
663 </tr></tbody></table> |
591 </tr></tbody></table> |
664 |
592 |
665 </div> |
593 </div> |
666 <?php } |
594 <?php |
|
595 } |
667 /** |
596 /** |
668 * Fires after the content editor. |
597 * Fires after the content editor. |
669 * |
598 * |
670 * @since 3.5.0 |
599 * @since 3.5.0 |
671 * |
600 * |