2008-05-08 19:25:07 +02:00
< ? php
2008-08-16 09:27:34 +02:00
/**
* Post advanced form for inclusion in the administration panels .
*
* @ package WordPress
* @ subpackage Administration
*/
2008-05-08 19:25:07 +02:00
2009-08-03 02:04:45 +02:00
// don't load directly
2017-12-01 00:11:00 +01:00
if ( ! defined ( 'ABSPATH' ) ) {
die ( '-1' );
}
2009-08-03 02:04:45 +02:00
2015-05-28 23:41:30 +02:00
/**
2016-06-28 18:41:35 +02:00
* @ global string $post_type
* @ global WP_Post_Type $post_type_object
2019-08-04 14:28:56 +02:00
* @ global WP_Post $post Global post object .
2015-05-28 23:41:30 +02:00
*/
2015-01-10 06:29:22 +01:00
global $post_type , $post_type_object , $post ;
2019-04-17 03:56:52 +02:00
// Flag that we're not loading the block editor.
$current_screen = get_current_screen ();
$current_screen -> is_block_editor ( false );
2017-10-11 14:06:48 +02:00
if ( is_multisite () ) {
add_action ( 'admin_footer' , '_admin_notice_post_locked' );
} else {
2017-12-01 00:11:00 +01:00
$check_users = get_users (
array (
'fields' => 'ID' ,
'number' => 2 ,
)
);
2017-10-11 14:06:48 +02:00
2017-12-01 00:11:00 +01:00
if ( count ( $check_users ) > 1 ) {
2017-10-11 14:06:48 +02:00
add_action ( 'admin_footer' , '_admin_notice_post_locked' );
2017-12-01 00:11:00 +01:00
}
2017-10-11 14:06:48 +02:00
unset ( $check_users );
}
2017-12-01 00:11:00 +01:00
wp_enqueue_script ( 'post' );
2019-07-01 14:52:01 +02:00
$_wp_editor_expand = false ;
$_content_editor_dfw = false ;
2014-07-10 21:36:15 +02:00
2014-08-29 04:38:16 +02:00
/**
2016-05-22 20:01:30 +02:00
* Filters whether to enable the 'expand' functionality in the post editor .
2014-08-29 04:38:16 +02:00
*
* @ since 4.0 . 0
2014-11-30 10:51:23 +01:00
* @ since 4.1 . 0 Added the `$post_type` parameter .
2014-08-29 04:38:16 +02:00
*
2014-11-30 10:51:23 +01:00
* @ param bool $expand Whether to enable the 'expand' functionality . Default true .
2014-11-30 07:37:21 +01:00
* @ param string $post_type Post type .
2014-08-29 04:38:16 +02:00
*/
2014-07-16 00:37:14 +02:00
if ( post_type_supports ( $post_type , 'editor' ) && ! wp_is_mobile () &&
2017-11-27 00:57:55 +01:00
! ( $is_IE && preg_match ( '/MSIE [5678]/' , $_SERVER [ 'HTTP_USER_AGENT' ] ) ) &&
apply_filters ( 'wp_editor_expand' , true , $post_type ) ) {
2014-07-16 00:37:14 +02:00
2017-12-01 00:11:00 +01:00
wp_enqueue_script ( 'editor-expand' );
2014-11-26 03:50:24 +01:00
$_content_editor_dfw = true ;
2017-12-01 00:11:00 +01:00
$_wp_editor_expand = ( get_user_setting ( 'editor_expand' , 'on' ) === 'on' );
2014-07-10 21:36:15 +02:00
}
2010-04-16 16:03:48 +02:00
2017-12-01 00:11:00 +01:00
if ( wp_is_mobile () ) {
2012-04-11 04:20:51 +02:00
wp_enqueue_script ( 'jquery-touch-punch' );
2017-12-01 00:11:00 +01:00
}
2012-04-11 04:20:51 +02:00
2008-08-16 09:27:34 +02:00
/**
* Post ID global
2017-12-01 00:11:00 +01:00
*
2008-08-16 09:27:34 +02:00
* @ name $post_ID
* @ var int
*/
2017-12-01 00:11:00 +01: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-11 02:37:26 +02:00
2015-02-26 03:47:25 +01:00
if ( $post_ID == get_option ( 'page_for_posts' ) && empty ( $post -> post_content ) ) {
add_action ( 'edit_form_after_title' , '_wp_posts_page_notice' );
remove_post_type_support ( $post_type , 'editor' );
}
2014-04-08 19:40:28 +02: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 21:26:26 +01:00
if ( wp_attachment_is ( 'audio' , $post ) ) {
2014-04-08 19:40:28 +02:00
$thumbnail_support = post_type_supports ( 'attachment:audio' , 'thumbnail' ) || current_theme_supports ( 'post-thumbnails' , 'attachment:audio' );
2015-03-06 21:26:26 +01:00
} elseif ( wp_attachment_is ( 'video' , $post ) ) {
2014-04-08 19:40:28 +02:00
$thumbnail_support = post_type_supports ( 'attachment:video' , 'thumbnail' ) || current_theme_supports ( 'post-thumbnails' , 'attachment:video' );
}
}
2014-02-20 18:50:13 +01:00
2014-04-08 19:40:28 +02:00
if ( $thumbnail_support ) {
2012-11-21 00:22:03 +01:00
add_thickbox ();
2012-11-21 10:35:23 +01:00
wp_enqueue_media ( array ( 'post' => $post_ID ) );
2012-11-21 00:22:03 +01:00
}
2013-07-22 07:09:49 +02:00
// Add the local autosave notice HTML
add_action ( 'admin_footer' , '_local_storage_notice' );
2013-10-17 00:59:09 +02:00
/*
* @ todo Document the $messages array ( s ) .
*/
2015-01-10 22:21:22 +01:00
$permalink = get_permalink ( $post_ID );
if ( ! $permalink ) {
$permalink = '' ;
}
2010-01-11 22:42:45 +01:00
$messages = array ();
2015-06-19 23:49:25 +02:00
2019-07-01 14:52:01 +02: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-24 05:28:24 +02: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 21:40:25 +02:00
$viewable = is_post_type_viewable ( $post_type_object );
if ( $viewable ) {
2015-09-24 05:28:24 +02:00
// Preview post link.
2017-12-01 00:11:00 +01:00
$preview_post_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
2015-09-24 05:28:24 +02: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 21:40:25 +02:00
__ ( 'Preview post' )
);
2015-09-24 05:28:24 +02:00
// Scheduled post preview link.
2017-12-01 00:11:00 +01: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 21:40:25 +02:00
esc_url ( $permalink ),
__ ( 'Preview post' )
);
// View post link.
2017-12-01 00:11:00 +01: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 21:40:25 +02:00
esc_url ( $permalink ),
__ ( 'View post' )
);
2015-09-24 05:28:24 +02:00
// Preview page link.
2017-12-01 00:11:00 +01:00
$preview_page_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
2015-09-24 05:28:24 +02:00
esc_url ( $preview_url ),
__ ( 'Preview page' )
);
// Scheduled page preview link.
2017-12-01 00:11:00 +01:00
$scheduled_page_link_html = sprintf (
' <a target="_blank" href="%1$s">%2$s</a>' ,
2015-09-24 05:28:24 +02:00
esc_url ( $permalink ),
__ ( 'Preview page' )
);
// View page link.
2017-12-01 00:11:00 +01:00
$view_page_link_html = sprintf (
' <a href="%1$s">%2$s</a>' ,
2015-09-24 05:28:24 +02: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 21:40:25 +02:00
}
2019-09-09 01:24:56 +02:00
$scheduled_date = sprintf (
/* translators: Publish box date string. 1: Date, 2: Time. */
__ ( '%1$s at %2$s' ),
2020-01-20 04:14:06 +01:00
/* translators: Publish box date format, see https://www.php.net/date */
2019-09-09 01:24:56 +02:00
date_i18n ( _x ( 'M j, Y' , 'publish box date format' ), strtotime ( $post -> post_date ) ),
2020-01-20 04:14:06 +01:00
/* translators: Publish box time format, see https://www.php.net/date */
2019-09-09 01:24:56 +02:00
date_i18n ( _x ( 'H:i' , 'publish box time format' ), strtotime ( $post -> post_date ) )
);
2015-09-24 05:28:24 +02:00
2018-08-17 03:51:36 +02:00
$messages [ 'post' ] = array (
2017-12-01 00:11:00 +01: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-03 02:41:05 +02:00
/* translators: %s: Date and time of the revision. */
2017-12-01 00:11:00 +01: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-03 02:41:05 +02:00
/* translators: %s: Scheduled date for the post. */
2017-12-01 00:11:00 +01:00
9 => sprintf ( __ ( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html ,
2015-09-24 05:28:24 +02:00
10 => __ ( 'Post draft updated.' ) . $preview_post_link_html ,
2010-01-11 22:42:45 +01:00
);
2018-08-17 03:51:36 +02:00
$messages [ 'page' ] = array (
2017-12-01 00:11:00 +01: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-03 02:41:05 +02:00
/* translators: %s: Date and time of the revision. */
2017-12-01 00:11:00 +01: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-03 02:41:05 +02:00
/* translators: %s: Scheduled date for the page. */
2017-12-01 00:11:00 +01:00
9 => sprintf ( __ ( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html ,
2015-09-24 05:28:24 +02:00
10 => __ ( 'Page draft updated.' ) . $preview_page_link_html ,
2010-01-11 22:42:45 +01:00
);
2016-03-08 18:43:25 +01:00
$messages [ 'attachment' ] = array_fill ( 1 , 10 , __ ( 'Media file updated.' ) ); // Hack, for now.
2010-01-11 22:42:45 +01:00
2013-10-17 00:59:09 +02:00
/**
2016-05-22 20:01:30 +02:00
* Filters the post updated messages .
2013-10-17 00:59:09 +02:00
*
* @ since 3.0 . 0
*
2018-03-22 21:27:32 +01:00
* @ param array [] $messages Post updated messages . For defaults see `$messages` declarations above .
2013-10-17 00:59:09 +02:00
*/
2010-05-22 07:40:29 +02:00
$messages = apply_filters ( 'post_updated_messages' , $messages );
2009-10-11 02:37:26 +02:00
$message = false ;
2017-12-01 00:11:00 +01:00
if ( isset ( $_GET [ 'message' ] ) ) {
2008-03-21 04:31:12 +01:00
$_GET [ 'message' ] = absint ( $_GET [ 'message' ] );
2017-12-01 00:11:00 +01: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-11 02:37:26 +02:00
}
2008-05-08 19:25:07 +02:00
2017-12-01 00:11:00 +01:00
$notice = false ;
2010-02-06 11:07:57 +01:00
$form_extra = '' ;
2012-12-02 00:12:30 +01:00
if ( 'auto-draft' == $post -> post_status ) {
2017-12-01 00:11:00 +01:00
if ( 'edit' == $action ) {
2010-02-06 11:07:57 +01:00
$post -> post_title = '' ;
2017-12-01 00:11:00 +01:00
}
$autosave = false ;
2010-02-06 11:07:57 +01:00
$form_extra .= " <input type='hidden' id='auto_draft' name='auto_draft' value='1' /> " ;
2008-05-08 19:25:07 +02:00
} else {
2008-08-25 23:50:11 +02:00
$autosave = wp_get_post_autosave ( $post_ID );
2010-02-06 11:07:57 +01:00
}
2017-12-01 00:11:00 +01:00
$form_action = 'editpost' ;
2012-08-14 20:39:15 +02:00
$nonce_action = 'update-post_' . $post_ID ;
2017-12-01 00:11:00 +01:00
$form_extra .= " <input type='hidden' id='post_ID' name='post_ID' value=' " . esc_attr ( $post_ID ) . " ' /> " ;
2008-06-24 00:25:27 +02:00
2010-02-06 11:07:57 +01:00
// Detect if there exists an autosave newer than the post and if that autosave is different than the post
if ( $autosave && mysql2date ( 'U' , $autosave -> post_modified_gmt , false ) > mysql2date ( 'U' , $post -> post_modified_gmt , false ) ) {
2016-02-24 01:44:59 +01:00
foreach ( _wp_post_revision_fields ( $post ) as $autosave_field => $_autosave_field ) {
2010-02-06 11:07:57 +01: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 19:13:59 +02:00
$notice = sprintf (
2019-09-03 02:41:05 +02: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 19:13:59 +02: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 11:07:57 +01:00
break ;
2008-06-24 00:25:27 +02:00
}
}
2013-07-24 07:37:53 +02:00
// If this autosave isn't different from the current post, begone.
2017-12-01 00:11:00 +01:00
if ( ! $notice ) {
2013-07-24 07:37:53 +02:00
wp_delete_post_revision ( $autosave -> ID );
2017-12-01 00:11:00 +01:00
}
unset ( $autosave_field , $_autosave_field );
2008-05-08 19:25:07 +02:00
}
2017-12-01 00:11:00 +01:00
$post_type_object = get_post_type_object ( $post_type );
2010-01-11 22:42:45 +01:00
2008-08-20 23:42:31 +02:00
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
2013-09-25 02:18:11 +02:00
require_once ( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
2008-10-10 20:21:16 +02:00
2018-12-16 02:19:54 +01:00
register_and_do_post_meta_boxes ( $post );
2008-11-11 23:40:16 +01:00
2017-12-01 00:11:00 +01:00
add_screen_option (
2018-08-17 03:51:36 +02:00
'layout_columns' ,
array (
2017-12-01 00:11:00 +01:00
'max' => 2 ,
'default' => 2 ,
)
);
2011-10-02 08:59:36 +02:00
2010-05-26 05:36:04 +02:00
if ( 'post' == $post_type ) {
2017-12-01 00:11:00 +01: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 23:03:38 +02:00
2017-12-01 00:11:00 +01: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 06:53:25 +02: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 12:54:29 +02: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 17:43:26 +01: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 14:58:30 +01: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 11:07:23 +01: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>' ;
2014-04-08 03:39:14 +02:00
$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>' ;
2011-09-26 23:03:38 +02:00
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'title-post-editor' ,
'title' => __ ( 'Title and Post Editor' ),
'content' => $title_and_editor ,
)
);
2011-09-26 23:03:38 +02:00
2011-11-02 21:14:10 +01: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 19:13:59 +02:00
'<p>' . sprintf (
2019-09-03 02:41:05 +02: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 19:13:59 +02:00
__ ( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ),
'tools.php'
) . '</p>' .
2017-12-01 00:11:00 +01:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2019-07-26 00:45:57 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
2019-04-09 00:59:56 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
2010-05-26 05:36:04 +02:00
);
} elseif ( 'page' == $post_type ) {
2017-12-01 00:11:00 +01: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 21:13:23 +02:00
2011-11-02 21:14:10 +01:00
get_current_screen () -> set_help_sidebar (
2017-12-01 00:11:00 +01:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2019-07-26 00:45:57 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/article/pages-add-new-screen/">Documentation on Adding New Pages</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
2019-04-09 00:59:56 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
2010-05-26 05:36:04 +02:00
);
2012-09-24 15:13:09 +02:00
} elseif ( 'attachment' == $post_type ) {
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
2019-05-26 17:38:53 +02:00
'<p>' . __ ( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '</p>' .
2017-12-01 00:11:00 +01: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>' .
'<p>' . __ ( 'Remember to click Update Media to save metadata entered or changed.' ) . '</p>' ,
)
);
2012-09-24 15:13:09 +02:00
get_current_screen () -> set_help_sidebar (
2017-12-01 00:11:00 +01:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2019-07-26 00:45:57 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/article/edit-media/">Documentation on Edit Media</a>' ) . '</p>' .
2019-04-09 00:59:56 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
2012-09-24 15:13:09 +02:00
);
2010-05-26 05:36:04 +02:00
}
2010-01-15 17:58:36 +01:00
2012-11-22 10:00:39 +01:00
if ( 'post' == $post_type || 'page' == $post_type ) {
2017-12-01 00:11:00 +01: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>' ;
2019-07-26 00:45:57 +02: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/support/article/embeds/">Learn more about embeds</a>.' ) . '</p>' ;
2012-11-22 10:00:39 +01:00
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'inserting-media' ,
'title' => __ ( 'Inserting Media' ),
'content' => $inserting_media ,
)
);
2012-11-22 10:00:39 +01:00
}
if ( 'post' == $post_type ) {
2017-12-01 00:11:00 +01:00
$publish_box = '<p>' . __ ( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>' ;
2015-09-10 23:00:24 +02:00
$publish_box .= '<ul><li>' .
2015-12-12 02:56:29 +01: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 19:36:24 +02:00
'</li>' ;
2012-11-22 10:00:39 +01:00
if ( current_theme_supports ( 'post-formats' ) && post_type_supports ( 'post' , 'post-formats' ) ) {
2019-07-26 00:45:57 +02: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/support/article/post-formats/#supported-formats">Learn more about each post format</a>.' ) . '</li>' ;
2012-11-22 10:00:39 +01: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 19:13:59 +02:00
$publish_box .= '<li>' . sprintf (
2019-09-03 02:41:05 +02: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 19:13:59 +02: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 10:00:39 +01:00
}
$publish_box .= '</ul>' ;
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'publish-box' ,
'title' => __ ( 'Publish Settings' ),
'content' => $publish_box ,
)
);
2012-11-22 10:00:39 +01:00
2017-12-01 00:11:00 +01: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 10:00:39 +01:00
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'discussion-settings' ,
'title' => __ ( 'Discussion Settings' ),
'content' => $discussion_settings ,
)
);
2012-11-22 10:00:39 +01:00
} elseif ( 'page' == $post_type ) {
2017-12-01 00:11:00 +01: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 10:00:39 +01:00
}
2013-09-25 02:18:11 +02:00
require_once ( ABSPATH . 'wp-admin/admin-header.php' );
2008-08-20 23:42:31 +02:00
?>
2008-09-28 06:11:27 +02:00
2013-04-26 14:36:12 +02:00
< div class = " wrap " >
2017-12-01 00:11:00 +01:00
< h1 class = " wp-heading-inline " >
< ? php
2012-10-25 00:15:43 +02:00
echo esc_html ( $title );
2017-12-01 00:11:00 +01:00
?>
</ h1 >
2016-10-27 22:39:39 +02: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 " >
2008-11-05 20:17:22 +01:00
< ? php if ( $notice ) : ?>
2017-12-01 00:11:00 +01:00
< div id = " notice " class = " notice notice-warning " >< p id = " has-newer-autosave " >< ? php echo $notice ; ?> </p></div>
2008-11-05 20:17:22 +01:00
< ? php endif ; ?>
2009-10-11 02:37:26 +02:00
< ? php if ( $message ) : ?>
2015-04-02 00:06:28 +02:00
< div id = " message " class = " updated notice notice-success is-dismissible " >< p >< ? php echo $message ; ?> </p></div>
2008-11-05 20:17:22 +01:00
< ? php endif ; ?>
2013-04-03 00:51:09 +02:00
< div id = " lost-connection-notice " class = " error hidden " >
2013-07-18 23:33:59 +02:00
< p >< span class = " spinner " ></ span > < ? php _e ( '<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.' ); ?>
< span class = " hide-if-no-sessionstorage " >< ? php _e ( 'We’re backing up this post in your browser, just in case.' ); ?> </span>
</ p >
2013-04-03 00:51:09 +02:00
</ div >
2017-12-01 00:11:00 +01:00
< form name = " post " action = " post.php " method = " post " id = " post "
< ? php
2013-10-17 00:59:09 +02:00
/**
2014-11-24 06:22:23 +01:00
* Fires inside the post editor form tag .
2013-10-17 00:59:09 +02:00
*
* @ since 3.0 . 0
*
* @ param WP_Post $post Post object .
*/
2014-11-24 06:22:23 +01:00
do_action ( 'post_edit_form_tag' , $post );
2015-03-09 03:11:28 +01:00
$referer = wp_get_referer ();
2017-12-01 00:11:00 +01: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 21:43:53 +02:00
< input type = " hidden " id = " post_author " name = " post_author " value = " <?php echo esc_attr( $post->post_author ); ?> " />
2017-12-01 00:11:00 +01: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-09 03:11:28 +01:00
< input type = " hidden " id = " referredby " name = " referredby " value = " <?php echo $referer ? esc_url( $referer ) : ''; ?> " />
2011-09-27 22:52:07 +02: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-17 03:51:36 +02:00
< ? php
2011-09-27 22:52:07 +02:00
}
2017-12-01 00:11:00 +01:00
if ( 'draft' != get_post_status ( $post ) ) {
wp_original_referer_field ( true , 'previous' );
}
2008-08-20 23:42:31 +02:00
2010-04-18 11:23:03 +02:00
echo $form_extra ;
wp_nonce_field ( 'meta-box-order' , 'meta-box-order-nonce' , false );
wp_nonce_field ( 'closedpostboxes' , 'closedpostboxesnonce' , false );
?>
2008-08-20 23:42:31 +02:00
2013-10-17 00:59:09 +02: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-12-01 00:11:00 +01:00
do_action ( 'edit_form_top' , $post );
?>
2013-07-29 00:29:36 +02:00
2012-03-23 22:41:00 +01:00
< div id = " poststuff " >
2012-04-24 22:46:04 +02:00
< div id = " post-body " class = " metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?> " >
2013-05-30 23:33:46 +02:00
< div id = " post-body-content " >
2017-12-01 00:11:00 +01:00
< ? php if ( post_type_supports ( $post_type , 'title' ) ) { ?>
2008-08-20 23:42:31 +02:00
< div id = " titlediv " >
< div id = " titlewrap " >
2013-10-17 00:59:09 +02:00
< ? php
/**
2016-05-22 20:01:30 +02:00
* Filters the title field placeholder text .
2013-10-17 00:59:09 +02:00
*
* @ since 3.1 . 0
*
2019-03-14 18:39:53 +01:00
* @ param string $text Placeholder text . Default 'Add title' .
2013-10-17 00:59:09 +02:00
* @ param WP_Post $post Post object .
*/
2019-03-14 18:39:53 +01:00
$title_placeholder = apply_filters ( 'enter_title_here' , __ ( 'Add title' ), $post );
2013-10-17 00:59:09 +02:00
?>
2014-12-06 22:32:24 +01:00
< label class = " screen-reader-text " id = " title-prompt-text " for = " title " >< ? php echo $title_placeholder ; ?> </label>
2015-07-14 19:56:26 +02: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 23:42:31 +02:00
</ div >
2018-08-17 03:51:36 +02: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 23:42:31 +02:00
< div class = " inside " >
2018-08-17 03:51:36 +02:00
< ? php
if ( $viewable ) :
$sample_permalink_html = $post_type_object -> public ? get_sample_permalink_html ( $post -> ID ) : '' ;
2015-01-10 22:21:22 +01:00
2018-08-17 03:51:36 +02: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 21:54:25 +02:00
2018-08-17 03:51:36 +02:00
if ( ! empty ( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url ( '?page_id=' . $post -> ID ) ) {
$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>' ;
}
2017-12-01 00:11:00 +01:00
}
2010-03-09 20:36:38 +01:00
2018-08-17 03:51:36 +02: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 ;
?>
2013-04-17 06:08:46 +02:00
< div id = " edit-slug-box " class = " hide-if-no-js " >
2018-08-17 03:51:36 +02:00
< ? php
if ( $has_sample_permalink ) {
echo $sample_permalink_html ;
}
?>
2008-08-20 23:42:31 +02:00
</ div >
2018-08-17 03:51:36 +02: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 21:40:25 +02:00
endif ;
2018-08-17 03:51:36 +02:00
?>
2008-08-20 23:42:31 +02:00
</ div >
2018-08-17 03:51:36 +02:00
< ? php
wp_nonce_field ( 'samplepermalink' , 'samplepermalinknonce' , false );
?>
2012-09-22 00:52:54 +02:00
</ div ><!-- / titlediv -->
2018-08-17 03:51:36 +02:00
< ? php
2012-09-22 00:52:54 +02:00
}
2013-10-17 00:59:09 +02:00
/**
* Fires after the title field .
*
* @ since 3.5 . 0
*
* @ param WP_Post $post Post object .
*/
2013-07-08 17:45:53 +02:00
do_action ( 'edit_form_after_title' , $post );
2008-08-20 23:42:31 +02:00
2017-12-01 00:11:00 +01:00
if ( post_type_supports ( $post_type , 'editor' ) ) {
2017-11-23 05:09:49 +01:00
$_wp_editor_expand_class = '' ;
if ( $_wp_editor_expand ) {
$_wp_editor_expand_class = ' wp-editor-expand' ;
}
2018-08-17 03:51:36 +02:00
?>
2017-11-23 05:09:49 +01:00
< div id = " postdivrich " class = " postarea<?php echo $_wp_editor_expand_class ; ?> " >
2008-08-20 23:42:31 +02:00
2018-08-17 03:51:36 +02: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 21:28:12 +01: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 19:13:59 +02:00
< td id = " wp-word-count " class = " hide-if-no-js " >
< ? php
printf (
2019-09-03 02:41:05 +02: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 19:13:59 +02:00
__ ( 'Word count: %s' ),
'<span class="word-count">0</span>'
);
?>
</ td >
2009-03-25 15:29:22 +01:00
< td class = " autosave-info " >
2011-05-30 21:53:18 +02:00
< span class = " autosave-message " >& nbsp ; </ span >
2018-08-17 03:51:36 +02:00
< ? php
if ( 'auto-draft' != $post -> post_status ) {
echo '<span id="last-edit">' ;
2019-07-01 14:52:01 +02:00
$last_user = get_userdata ( get_post_meta ( $post_ID , '_edit_last' , true ) );
if ( $last_user ) {
2019-09-03 02:41:05 +02:00
/* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
2018-08-17 03:51:36 +02: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-03 02:41:05 +02:00
/* translators: 1: Post edited date, 2: Post edited time. */
2018-08-17 03:51:36 +02: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-12-01 00:11:00 +01:00
}
?>
2009-03-25 15:29:22 +01: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-29 00:53:15 +01:00
< td id = " content-resize-handle " class = " hide-if-no-js " >< br /></ td >
2009-03-25 15:29:22 +01:00
</ tr ></ tbody ></ table >
2008-08-20 23:42:31 +02:00
</ div >
2018-08-17 03:51:36 +02:00
< ? php
2017-12-01 00:11:00 +01:00
}
2013-10-17 00:59:09 +02:00
/**
* Fires after the content editor .
*
* @ since 3.5 . 0
*
* @ param WP_Post $post Post object .
*/
2013-07-08 17:45:53 +02:00
do_action ( 'edit_form_after_editor' , $post );
2013-03-05 00:22:17 +01:00
?>
2012-03-23 22:41:00 +01:00
</ div ><!-- / post - body - content -->
2008-08-20 23:42:31 +02:00
2012-03-23 22:41:00 +01:00
< div id = " postbox-container-1 " class = " postbox-container " >
< ? php
2013-10-17 00:59:09 +02:00
if ( 'page' == $post_type ) {
/**
* 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-12-01 00:11:00 +01:00
} else {
2013-10-17 00:59:09 +02: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 22:41:00 +01:00
2017-12-01 00:11:00 +01:00
do_meta_boxes ( $post_type , 'side' , $post );
2012-03-23 22:41:00 +01:00
?>
</ div >
< div id = " postbox-container-2 " class = " postbox-container " >
< ? php
2011-09-21 08:16:24 +02:00
2017-12-01 00:11:00 +01:00
do_meta_boxes ( null , 'normal' , $post );
2008-08-20 23:42:31 +02:00
2013-10-17 00:59:09 +02:00
if ( 'page' == $post_type ) {
/**
* Fires after 'normal' context meta boxes have been output for the 'page' post type .
*
2013-10-30 15:39:10 +01:00
* @ since 1.5 . 0
2013-10-17 00:59:09 +02:00
*
* @ param WP_Post $post Post object .
*/
do_action ( 'edit_page_form' , $post );
2017-12-01 00:11:00 +01:00
} else {
2013-10-17 00:59:09 +02:00
/**
* Fires after 'normal' context meta boxes have been output for all post types other than 'page' .
*
2013-10-30 15:39:10 +01:00
* @ since 1.5 . 0
2013-10-17 00:59:09 +02:00
*
* @ param WP_Post $post Post object .
*/
do_action ( 'edit_form_advanced' , $post );
}
2008-08-20 23:42:31 +02:00
2017-12-01 00:11:00 +01:00
do_meta_boxes ( null , 'advanced' , $post );
2008-02-08 19:51:37 +01:00
2012-03-23 22:41:00 +01:00
?>
2005-06-14 09:31:36 +02:00
</ div >
2012-03-23 22:41:00 +01:00
< ? php
2013-10-17 00:59:09 +02: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 22:41:00 +01:00
?>
</ div ><!-- / post - body -->
2008-10-23 00:08:58 +02:00
< br class = " clear " />
2008-08-20 23:42:31 +02:00
</ div ><!-- / poststuff -->
2005-09-27 01:55:36 +02:00
</ form >
2008-09-28 06:11:27 +02:00
</ div >
2008-03-15 23:57:47 +01:00
2011-11-05 06:41:25 +01:00
< ? php
2017-12-01 00:11:00 +01:00
if ( post_type_supports ( $post_type , 'comments' ) ) {
2011-11-05 06:41:25 +01:00
wp_comment_reply ();
2017-12-01 00:11:00 +01:00
}
2011-11-05 06:41:25 +01:00
?>
2008-08-24 08:56:22 +02:00
2014-12-13 23:08:23 +01:00
< ? php if ( ! wp_is_mobile () && post_type_supports ( $post_type , 'title' ) && '' === $post -> post_title ) : ?>
2008-03-15 23:57:47 +01:00
< script type = " text/javascript " >
try { document . post . title . focus ();} catch ( e ){}
</ script >
< ? php endif ; ?>