2008-05-08 13:25:07 -04:00
< ? php
2008-08-16 03:27:34 -04:00
/**
* Post advanced form for inclusion in the administration panels .
*
* @ package WordPress
* @ subpackage Administration
*/
2008-05-08 13:25:07 -04:00
2020-01-28 19:45:18 -05:00
// Don't load directly.
2017-11-30 18:11:00 -05:00
if ( ! defined ( 'ABSPATH' ) ) {
die ( '-1' );
}
2009-08-02 20:04:45 -04:00
2015-05-28 17:41:30 -04:00
/**
2016-06-28 12:41:35 -04:00
* @ global string $post_type
* @ global WP_Post_Type $post_type_object
2019-08-04 08:28:56 -04:00
* @ global WP_Post $post Global post object .
2015-05-28 17:41:30 -04:00
*/
2015-01-10 00:29:22 -05:00
global $post_type , $post_type_object , $post ;
2019-04-16 21:56:52 -04:00
// Flag that we're not loading the block editor.
$current_screen = get_current_screen ();
$current_screen -> is_block_editor ( false );
2017-10-11 08:06:48 -04:00
if ( is_multisite () ) {
add_action ( 'admin_footer' , '_admin_notice_post_locked' );
} else {
2017-11-30 18:11:00 -05:00
$check_users = get_users (
array (
'fields' => 'ID' ,
'number' => 2 ,
)
);
2017-10-11 08:06:48 -04:00
2017-11-30 18:11:00 -05:00
if ( count ( $check_users ) > 1 ) {
2017-10-11 08:06:48 -04:00
add_action ( 'admin_footer' , '_admin_notice_post_locked' );
2017-11-30 18:11:00 -05:00
}
2017-10-11 08:06:48 -04:00
unset ( $check_users );
}
2017-11-30 18:11:00 -05:00
wp_enqueue_script ( 'post' );
2019-07-01 08:52:01 -04:00
$_wp_editor_expand = false ;
$_content_editor_dfw = false ;
2014-07-10 15:36:15 -04:00
2020-08-03 08:11:06 -04:00
if ( post_type_supports ( $post_type , 'editor' )
&& ! wp_is_mobile ()
&& ! ( $is_IE && preg_match ( '/MSIE [5678]/' , $_SERVER [ 'HTTP_USER_AGENT' ] ) )
) {
2020-09-04 17:48:07 -04:00
/**
* Filters whether to enable the 'expand' functionality in the post editor .
*
* @ since 4.0 . 0
* @ since 4.1 . 0 Added the `$post_type` parameter .
*
* @ param bool $expand Whether to enable the 'expand' functionality . Default true .
* @ param string $post_type Post type .
*/
if ( apply_filters ( 'wp_editor_expand' , true , $post_type ) ) {
wp_enqueue_script ( 'editor-expand' );
$_content_editor_dfw = true ;
$_wp_editor_expand = ( 'on' === get_user_setting ( 'editor_expand' , 'on' ) );
}
2014-07-10 15:36:15 -04:00
}
2010-04-16 10:03:48 -04:00
2017-11-30 18:11:00 -05:00
if ( wp_is_mobile () ) {
2012-04-10 22:20:51 -04:00
wp_enqueue_script ( 'jquery-touch-punch' );
2017-11-30 18:11:00 -05:00
}
2012-04-10 22:20:51 -04:00
2008-08-16 03:27:34 -04:00
/**
* Post ID global
2017-11-30 18:11:00 -05:00
*
2008-08-16 03:27:34 -04:00
* @ name $post_ID
* @ var int
*/
2017-11-30 18:11:00 -05:00
$post_ID = isset ( $post_ID ) ? ( int ) $post_ID : 0 ;
$user_ID = isset ( $user_ID ) ? ( int ) $user_ID : 0 ;
$action = isset ( $action ) ? $action : '' ;
2009-10-10 20:37:26 -04:00
2021-04-09 07:31:09 -04:00
if ( ( int ) get_option ( 'page_for_posts' ) === $post -> ID && empty ( $post -> post_content ) ) {
2015-02-25 21:47:25 -05:00
add_action ( 'edit_form_after_title' , '_wp_posts_page_notice' );
remove_post_type_support ( $post_type , 'editor' );
}
2014-04-08 13:40:28 -04:00
$thumbnail_support = current_theme_supports ( 'post-thumbnails' , $post_type ) && post_type_supports ( $post_type , 'thumbnail' );
if ( ! $thumbnail_support && 'attachment' === $post_type && $post -> post_mime_type ) {
2015-03-06 15:26:26 -05:00
if ( wp_attachment_is ( 'audio' , $post ) ) {
2014-04-08 13:40:28 -04:00
$thumbnail_support = post_type_supports ( 'attachment:audio' , 'thumbnail' ) || current_theme_supports ( 'post-thumbnails' , 'attachment:audio' );
2015-03-06 15:26:26 -05:00
} elseif ( wp_attachment_is ( 'video' , $post ) ) {
2014-04-08 13:40:28 -04:00
$thumbnail_support = post_type_supports ( 'attachment:video' , 'thumbnail' ) || current_theme_supports ( 'post-thumbnails' , 'attachment:video' );
}
}
2014-02-20 12:50:13 -05:00
2014-04-08 13:40:28 -04:00
if ( $thumbnail_support ) {
2012-11-20 18:22:03 -05:00
add_thickbox ();
2021-04-09 07:31:09 -04:00
wp_enqueue_media ( array ( 'post' => $post -> ID ) );
2012-11-20 18:22:03 -05:00
}
2020-01-28 19:45:18 -05:00
// Add the local autosave notice HTML.
2013-07-22 01:09:49 -04:00
add_action ( 'admin_footer' , '_local_storage_notice' );
2013-10-16 18:59:09 -04:00
/*
* @ todo Document the $messages array ( s ) .
*/
2021-04-09 07:31:09 -04:00
$permalink = get_permalink ( $post -> ID );
2015-01-10 16:21:22 -05:00
if ( ! $permalink ) {
$permalink = '' ;
}
2010-01-11 16:42:45 -05:00
$messages = array ();
2015-06-19 17:49:25 -04:00
2019-07-01 08:52:01 -04:00
$preview_post_link_html = '' ;
$scheduled_post_link_html = '' ;
$view_post_link_html = '' ;
$preview_page_link_html = '' ;
$scheduled_page_link_html = '' ;
$view_page_link_html = '' ;
2015-09-23 23:28:24 -04:00
$preview_url = get_preview_post_link ( $post );
Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with `public_queryable` set to `false` are not viewable on the front end.
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:
`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`
If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.
Built from https://develop.svn.wordpress.org/trunk@33666
git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 15:40:25 -04:00
$viewable = is_post_type_viewable ( $post_type_object );
if ( $viewable ) {
2015-09-23 23:28:24 -04:00
// Preview post link.
2017-11-30 18:11:00 -05:00
$preview_post_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
2015-09-23 23:28:24 -04:00
esc_url ( $preview_url ),
Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with `public_queryable` set to `false` are not viewable on the front end.
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:
`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`
If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.
Built from https://develop.svn.wordpress.org/trunk@33666
git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 15:40:25 -04:00
__ ( 'Preview post' )
);
2015-09-23 23:28:24 -04:00
// Scheduled post preview link.
2017-11-30 18:11:00 -05:00
$scheduled_post_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with `public_queryable` set to `false` are not viewable on the front end.
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:
`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`
If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.
Built from https://develop.svn.wordpress.org/trunk@33666
git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 15:40:25 -04:00
esc_url ( $permalink ),
__ ( 'Preview post' )
);
// View post link.
2017-11-30 18:11:00 -05:00
$view_post_link_html = sprintf (
' <a href="%1$s">%2$s</a>' ,
Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with `public_queryable` set to `false` are not viewable on the front end.
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:
`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`
If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.
Built from https://develop.svn.wordpress.org/trunk@33666
git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 15:40:25 -04:00
esc_url ( $permalink ),
__ ( 'View post' )
);
2015-09-23 23:28:24 -04:00
// Preview page link.
2017-11-30 18:11:00 -05:00
$preview_page_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
2015-09-23 23:28:24 -04:00
esc_url ( $preview_url ),
__ ( 'Preview page' )
);
// Scheduled page preview link.
2017-11-30 18:11:00 -05:00
$scheduled_page_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
2015-09-23 23:28:24 -04:00
esc_url ( $permalink ),
__ ( 'Preview page' )
);
// View page link.
2017-11-30 18:11:00 -05:00
$view_page_link_html = sprintf (
' <a href="%1$s">%2$s</a>' ,
2015-09-23 23:28:24 -04:00
esc_url ( $permalink ),
__ ( 'View page' )
);
Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with `public_queryable` set to `false` are not viewable on the front end.
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:
`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`
If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.
Built from https://develop.svn.wordpress.org/trunk@33666
git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 15:40:25 -04:00
}
2019-09-08 19:24:56 -04:00
$scheduled_date = sprintf (
/* translators: Publish box date string. 1: Date, 2: Time. */
__ ( '%1$s at %2$s' ),
2020-09-18 06:37:08 -04:00
/* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */
2019-09-08 19:24:56 -04:00
date_i18n ( _x ( 'M j, Y' , 'publish box date format' ), strtotime ( $post -> post_date ) ),
2020-09-18 06:37:08 -04:00
/* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */
2019-09-08 19:24:56 -04:00
date_i18n ( _x ( 'H:i' , 'publish box time format' ), strtotime ( $post -> post_date ) )
);
2015-09-23 23:28:24 -04:00
2018-08-16 21:51:36 -04:00
$messages [ 'post' ] = array (
2017-11-30 18:11:00 -05:00
0 => '' , // Unused. Messages start at index 1.
1 => __ ( 'Post updated.' ) . $view_post_link_html ,
2 => __ ( 'Custom field updated.' ),
3 => __ ( 'Custom field deleted.' ),
4 => __ ( 'Post updated.' ),
2019-09-02 20:41:05 -04:00
/* translators: %s: Date and time of the revision. */
2017-11-30 18:11:00 -05:00
5 => isset ( $_GET [ 'revision' ] ) ? sprintf ( __ ( 'Post restored to revision from %s.' ), wp_post_revision_title ( ( int ) $_GET [ 'revision' ], false ) ) : false ,
6 => __ ( 'Post published.' ) . $view_post_link_html ,
7 => __ ( 'Post saved.' ),
8 => __ ( 'Post submitted.' ) . $preview_post_link_html ,
2019-09-02 20:41:05 -04:00
/* translators: %s: Scheduled date for the post. */
2017-11-30 18:11:00 -05:00
9 => sprintf ( __ ( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html ,
2015-09-23 23:28:24 -04:00
10 => __ ( 'Post draft updated.' ) . $preview_post_link_html ,
2010-01-11 16:42:45 -05:00
);
2018-08-16 21:51:36 -04:00
$messages [ 'page' ] = array (
2017-11-30 18:11:00 -05:00
0 => '' , // Unused. Messages start at index 1.
1 => __ ( 'Page updated.' ) . $view_page_link_html ,
2 => __ ( 'Custom field updated.' ),
3 => __ ( 'Custom field deleted.' ),
4 => __ ( 'Page updated.' ),
2019-09-02 20:41:05 -04:00
/* translators: %s: Date and time of the revision. */
2017-11-30 18:11:00 -05:00
5 => isset ( $_GET [ 'revision' ] ) ? sprintf ( __ ( 'Page restored to revision from %s.' ), wp_post_revision_title ( ( int ) $_GET [ 'revision' ], false ) ) : false ,
6 => __ ( 'Page published.' ) . $view_page_link_html ,
7 => __ ( 'Page saved.' ),
8 => __ ( 'Page submitted.' ) . $preview_page_link_html ,
2019-09-02 20:41:05 -04:00
/* translators: %s: Scheduled date for the page. */
2017-11-30 18:11:00 -05:00
9 => sprintf ( __ ( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html ,
2015-09-23 23:28:24 -04:00
10 => __ ( 'Page draft updated.' ) . $preview_page_link_html ,
2010-01-11 16:42:45 -05:00
);
2016-03-08 12:43:25 -05:00
$messages [ 'attachment' ] = array_fill ( 1 , 10 , __ ( 'Media file updated.' ) ); // Hack, for now.
2010-01-11 16:42:45 -05:00
2013-10-16 18:59:09 -04:00
/**
2016-05-22 14:01:30 -04:00
* Filters the post updated messages .
2013-10-16 18:59:09 -04:00
*
* @ since 3.0 . 0
*
2018-03-22 16:27:32 -04:00
* @ param array [] $messages Post updated messages . For defaults see `$messages` declarations above .
2013-10-16 18:59:09 -04:00
*/
2010-05-22 01:40:29 -04:00
$messages = apply_filters ( 'post_updated_messages' , $messages );
2009-10-10 20:37:26 -04:00
$message = false ;
2017-11-30 18:11:00 -05:00
if ( isset ( $_GET [ 'message' ] ) ) {
2008-03-20 23:31:12 -04:00
$_GET [ 'message' ] = absint ( $_GET [ 'message' ] );
2017-11-30 18:11:00 -05:00
if ( isset ( $messages [ $post_type ][ $_GET [ 'message' ] ] ) ) {
$message = $messages [ $post_type ][ $_GET [ 'message' ] ];
} elseif ( ! isset ( $messages [ $post_type ] ) && isset ( $messages [ 'post' ][ $_GET [ 'message' ] ] ) ) {
$message = $messages [ 'post' ][ $_GET [ 'message' ] ];
}
2009-10-10 20:37:26 -04:00
}
2008-05-08 13:25:07 -04:00
2017-11-30 18:11:00 -05:00
$notice = false ;
2010-02-06 05:07:57 -05:00
$form_extra = '' ;
2020-05-12 14:32:08 -04:00
if ( 'auto-draft' === $post -> post_status ) {
if ( 'edit' === $action ) {
2010-02-06 05:07:57 -05:00
$post -> post_title = '' ;
2017-11-30 18:11:00 -05:00
}
$autosave = false ;
2010-02-06 05:07:57 -05:00
$form_extra .= " <input type='hidden' id='auto_draft' name='auto_draft' value='1' /> " ;
2008-05-08 13:25:07 -04:00
} else {
2021-04-09 07:31:09 -04:00
$autosave = wp_get_post_autosave ( $post -> ID );
2010-02-06 05:07:57 -05:00
}
2017-11-30 18:11:00 -05:00
$form_action = 'editpost' ;
2021-04-09 07:31:09 -04:00
$nonce_action = 'update-post_' . $post -> ID ;
$form_extra .= " <input type='hidden' id='post_ID' name='post_ID' value=' " . esc_attr ( $post -> ID ) . " ' /> " ;
2008-06-23 18:25:27 -04:00
2020-01-28 19:45:18 -05:00
// Detect if there exists an autosave newer than the post and if that autosave is different than the post.
2010-02-06 05:07:57 -05:00
if ( $autosave && mysql2date ( 'U' , $autosave -> post_modified_gmt , false ) > mysql2date ( 'U' , $post -> post_modified_gmt , false ) ) {
2016-02-23 19:44:59 -05:00
foreach ( _wp_post_revision_fields ( $post ) as $autosave_field => $_autosave_field ) {
2020-02-25 14:35:09 -05:00
if ( normalize_whitespace ( $autosave -> $autosave_field ) !== normalize_whitespace ( $post -> $autosave_field ) ) {
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
$notice = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: URL to view the autosave. */
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
__ ( '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 )
);
2010-02-06 05:07:57 -05:00
break ;
2008-06-23 18:25:27 -04:00
}
}
2013-07-24 01:37:53 -04:00
// If this autosave isn't different from the current post, begone.
2017-11-30 18:11:00 -05:00
if ( ! $notice ) {
2013-07-24 01:37:53 -04:00
wp_delete_post_revision ( $autosave -> ID );
2017-11-30 18:11:00 -05:00
}
unset ( $autosave_field , $_autosave_field );
2008-05-08 13:25:07 -04:00
}
2017-11-30 18:11:00 -05:00
$post_type_object = get_post_type_object ( $post_type );
2010-01-11 16:42:45 -05:00
2008-08-20 17:42:31 -04:00
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/includes/meta-boxes.php' ;
2008-10-10 14:21:16 -04:00
2018-12-15 20:19:54 -05:00
register_and_do_post_meta_boxes ( $post );
2008-11-11 17:40:16 -05:00
2017-11-30 18:11:00 -05:00
add_screen_option (
2018-08-16 21:51:36 -04:00
'layout_columns' ,
array (
2017-11-30 18:11:00 -05:00
'max' => 2 ,
'default' => 2 ,
)
);
2011-10-02 02:59:36 -04:00
2020-05-12 14:32:08 -04:00
if ( 'post' === $post_type ) {
2017-11-30 18:11:00 -05:00
$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>' ;
get_current_screen () -> add_help_tab (
array (
'id' => 'customize-display' ,
'title' => __ ( 'Customizing This Display' ),
'content' => $customize_display ,
)
);
2011-09-26 17:03:38 -04:00
2017-11-30 18:11:00 -05:00
$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>' ;
2015-08-19 00:53:25 -04:00
$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>' ;
2016-04-05 06:54:29 -04:00
$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>' ;
2016-03-12 11:43:26 -05:00
$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>' ;
2018-02-03 08:58:30 -05:00
$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>' ;
2014-12-16 05:07:23 -05:00
$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>' ;
2020-06-27 19:02:03 -04:00
$title_and_editor .= '<p>' . sprintf (
/* translators: %s: Alt + F10 */
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 12:25:03 -04:00
__ ( 'Keyboard users: When you are working in the visual editor, you can use %s to access the toolbar.' ),
2020-06-27 19:02:03 -04:00
'<kbd>Alt + F10</kbd>'
) . '</p>' ;
2011-09-26 17:03:38 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'title-post-editor' ,
'title' => __ ( 'Title and Post Editor' ),
'content' => $title_and_editor ,
)
);
2011-09-26 17:03:38 -04:00
2011-11-02 16:14:10 -04:00
get_current_screen () -> set_help_sidebar (
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
'<p>' . sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: URL to Press This bookmarklet. */
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
__ ( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ),
'tools.php'
) . '</p>' .
2017-11-30 18:11:00 -05:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 06:06:19 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/write-posts-classic-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
2023-02-23 05:38:21 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2010-05-25 23:36:04 -04:00
);
2020-05-12 14:32:08 -04:00
} elseif ( 'page' === $post_type ) {
2017-11-30 18:11:00 -05:00
$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>' .
'<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>' ;
get_current_screen () -> add_help_tab (
array (
'id' => 'about-pages' ,
'title' => __ ( 'About Pages' ),
'content' => $about_pages ,
)
);
2011-10-24 15:13:23 -04:00
2011-11-02 16:14:10 -04:00
get_current_screen () -> set_help_sidebar (
2017-11-30 18:11:00 -05:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 05:38:21 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/pages-add-new-screen/">Documentation on Adding New Pages</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2010-05-25 23:36:04 -04:00
);
2020-05-12 14:32:08 -04:00
} elseif ( 'attachment' === $post_type ) {
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
2019-05-26 11:38:53 -04:00
'<p>' . __ ( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '</p>' .
2017-11-30 18:11:00 -05:00
'<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>' .
'<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>' .
2023-02-02 15:24:20 -05:00
'<p>' . __ ( 'Remember to click Update to save metadata entered or changed.' ) . '</p>' ,
2017-11-30 18:11:00 -05:00
)
);
2012-09-24 09:13:09 -04:00
get_current_screen () -> set_help_sidebar (
2017-11-30 18:11:00 -05:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 05:38:21 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/edit-media/">Documentation on Edit Media</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2012-09-24 09:13:09 -04:00
);
2010-05-25 23:36:04 -04:00
}
2010-01-15 11:58:36 -05:00
2020-05-12 14:32:08 -04:00
if ( 'post' === $post_type || 'page' === $post_type ) {
2017-11-30 18:11:00 -05:00
$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>' ;
2023-02-23 05:38:21 -05:00
$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. <a href="https://wordpress.org/documentation/article/embeds/">Learn more about embeds</a>.' ) . '</p>' ;
2012-11-22 04:00:39 -05:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'inserting-media' ,
'title' => __ ( 'Inserting Media' ),
'content' => $inserting_media ,
)
);
2012-11-22 04:00:39 -05:00
}
2020-05-12 14:32:08 -04:00
if ( 'post' === $post_type ) {
2017-11-30 18:11:00 -05:00
$publish_box = '<p>' . __ ( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>' ;
2015-09-10 17:00:24 -04:00
$publish_box .= '<ul><li>' .
2015-12-11 20:56:29 -05:00
__ ( '<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.' ) .
2015-09-10 13:36:24 -04:00
'</li>' ;
2012-11-22 04:00:39 -05:00
if ( current_theme_supports ( 'post-formats' ) && post_type_supports ( 'post' , 'post-formats' ) ) {
2023-02-23 05:38:21 -05:00
$publish_box .= '<li>' . __ ( '<strong>Format</strong> — Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Your theme could enable all or some of 10 possible formats. <a href="https://wordpress.org/documentation/article/post-formats/#supported-formats">Learn more about each post format</a>.' ) . '</li>' ;
2012-11-22 04:00:39 -05:00
}
if ( current_theme_supports ( 'post-thumbnails' ) && post_type_supports ( 'post' , 'thumbnail' ) ) {
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
$publish_box .= '<li>' . sprintf (
2020-02-05 14:09:05 -05:00
/* translators: %s: Featured image. */
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
__ ( '<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>' ;
2012-11-22 04:00:39 -05:00
}
$publish_box .= '</ul>' ;
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'publish-box' ,
'title' => __ ( 'Publish Settings' ),
'content' => $publish_box ,
)
);
2012-11-22 04:00:39 -05:00
2017-11-30 18:11:00 -05:00
$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>' ;
$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>' ;
2012-11-22 04:00:39 -05:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'discussion-settings' ,
'title' => __ ( 'Discussion Settings' ),
'content' => $discussion_settings ,
)
);
2020-05-12 14:32:08 -04:00
} elseif ( 'page' === $post_type ) {
2017-11-30 18:11:00 -05:00
$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>' .
'<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>' .
'<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>' ;
get_current_screen () -> add_help_tab (
array (
'id' => 'page-attributes' ,
'title' => __ ( 'Page Attributes' ),
'content' => $page_attributes ,
)
);
2012-11-22 04:00:39 -05:00
}
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2008-08-20 17:42:31 -04:00
?>
2008-09-28 00:11:27 -04:00
2013-04-26 08:36:12 -04:00
< div class = " wrap " >
2017-11-30 18:11:00 -05:00
< h1 class = " wp-heading-inline " >
< ? php
2012-10-24 18:15:43 -04:00
echo esc_html ( $title );
2017-11-30 18:11:00 -05:00
?>
</ h1 >
2016-10-27 16:39:39 -04:00
< ? php
if ( isset ( $post_new_file ) && current_user_can ( $post_type_object -> cap -> create_posts ) ) {
echo ' <a href="' . esc_url ( admin_url ( $post_new_file ) ) . '" class="page-title-action">' . esc_html ( $post_type_object -> labels -> add_new ) . '</a>' ;
}
?>
< hr class = " wp-header-end " >
2023-09-13 20:54:19 -04:00
< ? php
if ( $notice ) :
wp_admin_notice (
'<p id="has-newer-autosave">' . $notice . '</p>' ,
array (
'type' => 'warning' ,
'id' => 'notice' ,
'paragraph_wrap' => false ,
)
);
endif ;
if ( $message ) :
wp_admin_notice (
$message ,
array (
'type' => 'success' ,
'dismissible' => true ,
'id' => 'message' ,
'additional_classes' => array ( 'updated' ),
)
);
endif ;
?>
2013-04-02 18:51:09 -04:00
< div id = " lost-connection-notice " class = " error hidden " >
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 12:25:03 -04:00
< p >< span class = " spinner " ></ span > < ? php _e ( '<strong>Connection lost.</strong> Saving has been disabled until you are reconnected.' ); ?>
Administration: Remove self-reference ("we") in WordPress Admin.
This changes updates many strings to remove self-references to an undefined "we" collective across the WordPress Administration.
The goal of this change is to better match the guidelines and recommendations set forth in the make/core handbook, specifically:
> the word "we" should be avoided (…) unless its made very clear which group is speaking.
Props johnbillion, shital-patel, audrasjb, marybaum, SergeyBiryukov, peterwilsoncc, johnjamesjacoby, kebbet, costdev, chaion07, davidbaumwald.
Fixes #46057.
Built from https://develop.svn.wordpress.org/trunk@53131
git-svn-id: http://core.svn.wordpress.org/trunk@52720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 07:42:04 -04:00
< span class = " hide-if-no-sessionstorage " >< ? php _e ( 'This post is being backed up in your browser, just in case.' ); ?> </span>
2013-07-18 17:33:59 -04:00
</ p >
2013-04-02 18:51:09 -04:00
</ div >
2017-11-30 18:11:00 -05:00
< form name = " post " action = " post.php " method = " post " id = " post "
< ? php
2013-10-16 18:59:09 -04:00
/**
2014-11-24 00:22:23 -05:00
* Fires inside the post editor form tag .
2013-10-16 18:59:09 -04:00
*
* @ since 3.0 . 0
*
* @ param WP_Post $post Post object .
*/
2014-11-24 00:22:23 -05:00
do_action ( 'post_edit_form_tag' , $post );
2015-03-08 22:11:28 -04:00
$referer = wp_get_referer ();
2017-11-30 18:11:00 -05:00
?>
>
< ? php wp_nonce_field ( $nonce_action ); ?>
< input type = " hidden " id = " user-id " name = " user_ID " value = " <?php echo (int) $user_ID ; ?> " />
< input type = " hidden " id = " hiddenaction " name = " action " value = " <?php echo esc_attr( $form_action ); ?> " />
< input type = " hidden " id = " originalaction " name = " originalaction " value = " <?php echo esc_attr( $form_action ); ?> " />
2009-05-05 15:43:53 -04:00
< input type = " hidden " id = " post_author " name = " post_author " value = " <?php echo esc_attr( $post->post_author ); ?> " />
2017-11-30 18:11:00 -05:00
< input type = " hidden " id = " post_type " name = " post_type " value = " <?php echo esc_attr( $post_type ); ?> " />
< input type = " hidden " id = " original_post_status " name = " original_post_status " value = " <?php echo esc_attr( $post->post_status ); ?> " />
2015-03-08 22:11:28 -04:00
< input type = " hidden " id = " referredby " name = " referredby " value = " <?php echo $referer ? esc_url( $referer ) : ''; ?> " />
2011-09-27 16:52:07 -04:00
< ? php if ( ! empty ( $active_post_lock ) ) { ?>
< input type = " hidden " id = " active_post_lock " value = " <?php echo esc_attr( implode( ':', $active_post_lock ) ); ?> " />
2018-08-16 21:51:36 -04:00
< ? php
2011-09-27 16:52:07 -04:00
}
2020-05-12 14:32:08 -04:00
if ( 'draft' !== get_post_status ( $post ) ) {
2017-11-30 18:11:00 -05:00
wp_original_referer_field ( true , 'previous' );
}
2008-08-20 17:42:31 -04:00
2010-04-18 05:23:03 -04:00
echo $form_extra ;
wp_nonce_field ( 'meta-box-order' , 'meta-box-order-nonce' , false );
wp_nonce_field ( 'closedpostboxes' , 'closedpostboxesnonce' , false );
?>
2008-08-20 17:42:31 -04:00
2013-10-16 18:59:09 -04:00
< ? php
/**
* Fires at the beginning of the edit form .
*
* At this point , the required hidden fields and nonces have already been output .
*
* @ since 3.7 . 0
*
* @ param WP_Post $post Post object .
*/
2017-11-30 18:11:00 -05:00
do_action ( 'edit_form_top' , $post );
?>
2013-07-28 18:29:36 -04:00
2020-03-02 19:37:06 -05:00
< div id = " poststuff " >
2020-05-12 14:32:08 -04:00
< div id = " post-body " class = " metabox-holder columns-<?php echo ( 1 === get_current_screen()->get_columns() ) ? '1' : '2'; ?> " >
2013-05-30 17:33:46 -04:00
< div id = " post-body-content " >
2017-11-30 18:11:00 -05:00
< ? php if ( post_type_supports ( $post_type , 'title' ) ) { ?>
2008-08-20 17:42:31 -04:00
< div id = " titlediv " >
< div id = " titlewrap " >
2013-10-16 18:59:09 -04:00
< ? php
/**
2016-05-22 14:01:30 -04:00
* Filters the title field placeholder text .
2013-10-16 18:59:09 -04:00
*
* @ since 3.1 . 0
*
2019-03-14 13:39:53 -04:00
* @ param string $text Placeholder text . Default 'Add title' .
2013-10-16 18:59:09 -04:00
* @ param WP_Post $post Post object .
*/
2019-03-14 13:39:53 -04:00
$title_placeholder = apply_filters ( 'enter_title_here' , __ ( 'Add title' ), $post );
2013-10-16 18:59:09 -04:00
?>
2014-12-06 16:32:24 -05:00
< label class = " screen-reader-text " id = " title-prompt-text " for = " title " >< ? php echo $title_placeholder ; ?> </label>
2015-07-14 13:56:26 -04:00
< input type = " text " name = " post_title " size = " 30 " value = " <?php echo esc_attr( $post->post_title ); ?> " id = " title " spellcheck = " true " autocomplete = " off " />
2008-08-20 17:42:31 -04:00
</ div >
2018-08-16 21:51:36 -04:00
< ? php
/**
* Fires before the permalink field in the edit form .
*
* @ since 4.1 . 0
*
* @ param WP_Post $post Post object .
*/
do_action ( 'edit_form_before_permalink' , $post );
?>
2008-08-20 17:42:31 -04:00
< div class = " inside " >
2018-08-16 21:51:36 -04:00
< ? php
if ( $viewable ) :
$sample_permalink_html = $post_type_object -> public ? get_sample_permalink_html ( $post -> ID ) : '' ;
2015-01-10 16:21:22 -05:00
2018-08-16 21:51:36 -04:00
// As of 4.4, the Get Shortlink button is hidden by default.
if ( has_filter ( 'pre_get_shortlink' ) || has_filter ( 'get_shortlink' ) ) {
$shortlink = wp_get_shortlink ( $post -> ID , 'post' );
2015-09-25 15:54:25 -04:00
2020-02-09 11:55:09 -05:00
if ( ! empty ( $shortlink ) && $shortlink !== $permalink && home_url ( '?page_id=' . $post -> ID ) !== $permalink ) {
2020-05-12 14:32:08 -04:00
$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>' ;
2018-08-16 21:51:36 -04:00
}
2017-11-30 18:11:00 -05:00
}
2010-03-09 14:36:38 -05:00
2020-05-12 14:32:08 -04:00
if ( $post_type_object -> public
&& ! ( 'pending' === get_post_status ( $post ) && ! current_user_can ( $post_type_object -> cap -> publish_posts ) )
) {
$has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post -> post_status ;
2018-08-16 21:51:36 -04:00
?>
2013-04-17 00:08:46 -04:00
< div id = " edit-slug-box " class = " hide-if-no-js " >
2018-08-16 21:51:36 -04:00
< ? php
if ( $has_sample_permalink ) {
echo $sample_permalink_html ;
}
?>
2008-08-20 17:42:31 -04:00
</ div >
2018-08-16 21:51:36 -04:00
< ? php
}
Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with `public_queryable` set to `false` are not viewable on the front end.
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:
`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`
If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.
Built from https://develop.svn.wordpress.org/trunk@33666
git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 15:40:25 -04:00
endif ;
2018-08-16 21:51:36 -04:00
?>
2008-08-20 17:42:31 -04:00
</ div >
2018-08-16 21:51:36 -04:00
< ? php
wp_nonce_field ( 'samplepermalink' , 'samplepermalinknonce' , false );
?>
2012-09-21 18:52:54 -04:00
</ div ><!-- / titlediv -->
2018-08-16 21:51:36 -04:00
< ? php
2012-09-21 18:52:54 -04:00
}
2013-10-16 18:59:09 -04:00
/**
* Fires after the title field .
*
* @ since 3.5 . 0
*
* @ param WP_Post $post Post object .
*/
2013-07-08 11:45:53 -04:00
do_action ( 'edit_form_after_title' , $post );
2008-08-20 17:42:31 -04:00
2017-11-30 18:11:00 -05:00
if ( post_type_supports ( $post_type , 'editor' ) ) {
2017-11-22 23:09:49 -05:00
$_wp_editor_expand_class = '' ;
if ( $_wp_editor_expand ) {
$_wp_editor_expand_class = ' wp-editor-expand' ;
}
2018-08-16 21:51:36 -04:00
?>
2017-11-22 23:09:49 -05:00
< div id = " postdivrich " class = " postarea<?php echo $_wp_editor_expand_class ; ?> " >
2008-08-20 17:42:31 -04:00
2018-08-16 21:51:36 -04:00
< ? php
wp_editor (
$post -> post_content ,
'content' ,
array (
'_content_editor_dfw' => $_content_editor_dfw ,
'drag_drop_upload' => true ,
'tabfocus_elements' => 'content-html,save-post' ,
'editor_height' => 300 ,
'tinymce' => array (
'resize' => false ,
'wp_autoresize_on' => $_wp_editor_expand ,
'add_unload_trigger' => false ,
'wp_keep_scroll_position' => ! $is_IE ,
),
)
);
?>
2014-01-26 15:28:12 -05:00
< table id = " post-status-info " >< tbody >< tr >
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
< td id = " wp-word-count " class = " hide-if-no-js " >
< ? php
printf (
2019-09-02 20:41:05 -04:00
/* translators: %s: Number of words. */
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
__ ( 'Word count: %s' ),
'<span class="word-count">0</span>'
);
?>
</ td >
2009-03-25 10:29:22 -04:00
< td class = " autosave-info " >
2011-05-30 15:53:18 -04:00
< span class = " autosave-message " >& nbsp ; </ span >
2018-08-16 21:51:36 -04:00
< ? php
2020-05-12 14:32:08 -04:00
if ( 'auto-draft' !== $post -> post_status ) {
2018-08-16 21:51:36 -04:00
echo '<span id="last-edit">' ;
2021-04-09 07:31:09 -04:00
$last_user = get_userdata ( get_post_meta ( $post -> ID , '_edit_last' , true ) );
2019-07-01 08:52:01 -04:00
if ( $last_user ) {
2019-09-02 20:41:05 -04:00
/* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
2018-08-16 21:51:36 -04:00
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 ) );
} else {
2019-09-02 20:41:05 -04:00
/* translators: 1: Post edited date, 2: Post edited time. */
2018-08-16 21:51:36 -04:00
printf ( __ ( 'Last edited on %1$s at %2$s' ), mysql2date ( __ ( 'F j, Y' ), $post -> post_modified ), mysql2date ( __ ( 'g:i a' ), $post -> post_modified ) );
}
echo '</span>' ;
2017-11-30 18:11:00 -05:00
}
?>
2009-03-25 10:29:22 -04:00
</ td >
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
< td id = " content-resize-handle " class = " hide-if-no-js " >< br /></ td >
2009-03-25 10:29:22 -04:00
</ tr ></ tbody ></ table >
2008-08-20 17:42:31 -04:00
</ div >
2018-08-16 21:51:36 -04:00
< ? php
2017-11-30 18:11:00 -05:00
}
2013-10-16 18:59:09 -04:00
/**
* Fires after the content editor .
*
* @ since 3.5 . 0
*
* @ param WP_Post $post Post object .
*/
2013-07-08 11:45:53 -04:00
do_action ( 'edit_form_after_editor' , $post );
2013-03-04 18:22:17 -05:00
?>
2012-03-23 17:41:00 -04:00
</ div ><!-- / post - body - content -->
2008-08-20 17:42:31 -04:00
2012-03-23 17:41:00 -04:00
< div id = " postbox-container-1 " class = " postbox-container " >
< ? php
2020-05-12 14:32:08 -04:00
if ( 'page' === $post_type ) {
2013-10-16 18:59:09 -04:00
/**
* Fires before meta boxes with 'side' context are output for the 'page' post type .
*
* The submitpage box is a meta box with 'side' context , so this hook fires just before it is output .
*
* @ since 2.5 . 0
*
* @ param WP_Post $post Post object .
*/
do_action ( 'submitpage_box' , $post );
2017-11-30 18:11:00 -05:00
} else {
2013-10-16 18:59:09 -04:00
/**
* Fires before meta boxes with 'side' context are output for all post types other than 'page' .
*
* The submitpost box is a meta box with 'side' context , so this hook fires just before it is output .
*
* @ since 2.5 . 0
*
* @ param WP_Post $post Post object .
*/
do_action ( 'submitpost_box' , $post );
}
2012-03-23 17:41:00 -04:00
2017-11-30 18:11:00 -05:00
do_meta_boxes ( $post_type , 'side' , $post );
2012-03-23 17:41:00 -04:00
?>
</ div >
2020-03-02 19:37:06 -05:00
< div id = " postbox-container-2 " class = " postbox-container " >
2012-03-23 17:41:00 -04:00
< ? php
2011-09-21 02:16:24 -04:00
2017-11-30 18:11:00 -05:00
do_meta_boxes ( null , 'normal' , $post );
2008-08-20 17:42:31 -04:00
2020-05-12 14:32:08 -04:00
if ( 'page' === $post_type ) {
2013-10-16 18:59:09 -04:00
/**
* Fires after 'normal' context meta boxes have been output for the 'page' post type .
*
2013-10-30 10:39:10 -04:00
* @ since 1.5 . 0
2013-10-16 18:59:09 -04:00
*
* @ param WP_Post $post Post object .
*/
do_action ( 'edit_page_form' , $post );
2017-11-30 18:11:00 -05:00
} else {
2013-10-16 18:59:09 -04:00
/**
* Fires after 'normal' context meta boxes have been output for all post types other than 'page' .
*
2013-10-30 10:39:10 -04:00
* @ since 1.5 . 0
2013-10-16 18:59:09 -04:00
*
* @ param WP_Post $post Post object .
*/
do_action ( 'edit_form_advanced' , $post );
}
2008-08-20 17:42:31 -04:00
2017-11-30 18:11:00 -05:00
do_meta_boxes ( null , 'advanced' , $post );
2008-02-08 13:51:37 -05:00
2012-03-23 17:41:00 -04:00
?>
2005-06-14 03:31:36 -04:00
</ div >
2012-03-23 17:41:00 -04:00
< ? php
2013-10-16 18:59:09 -04:00
/**
* Fires after all meta box sections have been output , before the closing #post-body div.
*
* @ since 2.1 . 0
*
* @ param WP_Post $post Post object .
*/
do_action ( 'dbx_post_sidebar' , $post );
2012-03-23 17:41:00 -04:00
?>
</ div ><!-- / post - body -->
2008-10-22 18:08:58 -04:00
< br class = " clear " />
2008-08-20 17:42:31 -04:00
</ div ><!-- / poststuff -->
2005-09-26 19:55:36 -04:00
</ form >
2008-09-28 00:11:27 -04:00
</ div >
2008-03-15 18:57:47 -04:00
2011-11-05 01:41:25 -04:00
< ? php
2017-11-30 18:11:00 -05:00
if ( post_type_supports ( $post_type , 'comments' ) ) {
2011-11-05 01:41:25 -04:00
wp_comment_reply ();
2017-11-30 18:11:00 -05:00
}
2011-11-05 01:41:25 -04:00
?>
2008-08-24 02:56:22 -04:00
2014-12-13 17:08:23 -05:00
< ? php if ( ! wp_is_mobile () && post_type_supports ( $post_type , 'title' ) && '' === $post -> post_title ) : ?>
2008-03-15 18:57:47 -04:00
< script type = " text/javascript " >
try { document . post . title . focus ();} catch ( e ){}
</ script >
< ? php endif ; ?>