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
2009-08-02 20:04:45 -04: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
* @ global WP_Post $post
2015-05-28 17:41:30 -04:00
*/
2015-01-10 00:29:22 -05:00
global $post_type , $post_type_object , $post ;
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' );
2014-11-25 21:50:24 -05:00
$_wp_editor_expand = $_content_editor_dfw = false ;
2014-07-10 15:36:15 -04:00
2014-08-28 22:38:16 -04:00
/**
2016-05-22 14:01:30 -04:00
* Filters whether to enable the 'expand' functionality in the post editor .
2014-08-28 22:38:16 -04:00
*
* @ since 4.0 . 0
2014-11-30 04:51:23 -05:00
* @ since 4.1 . 0 Added the `$post_type` parameter .
2014-08-28 22:38:16 -04:00
*
2014-11-30 04:51:23 -05:00
* @ param bool $expand Whether to enable the 'expand' functionality . Default true .
2014-11-30 01:37:21 -05:00
* @ param string $post_type Post type .
2014-08-28 22:38:16 -04:00
*/
2014-07-15 18:37:14 -04:00
if ( post_type_supports ( $post_type , 'editor' ) && ! wp_is_mobile () &&
2017-11-26 18:57:55 -05:00
! ( $is_IE && preg_match ( '/MSIE [5678]/' , $_SERVER [ 'HTTP_USER_AGENT' ] ) ) &&
apply_filters ( 'wp_editor_expand' , true , $post_type ) ) {
2014-07-15 18:37:14 -04:00
2017-11-30 18:11:00 -05:00
wp_enqueue_script ( 'editor-expand' );
2014-11-25 21:50:24 -05:00
$_content_editor_dfw = true ;
2017-11-30 18:11:00 -05:00
$_wp_editor_expand = ( get_user_setting ( 'editor_expand' , 'on' ) === '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
2015-02-25 21:47:25 -05: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 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 ();
2012-11-21 04:35:23 -05:00
wp_enqueue_media ( array ( 'post' => $post_ID ) );
2012-11-20 18:22:03 -05:00
}
2013-07-22 01:09:49 -04:00
// Add the local autosave notice HTML
add_action ( 'admin_footer' , '_local_storage_notice' );
2013-10-16 18:59:09 -04:00
/*
* @ todo Document the $messages array ( s ) .
*/
2015-01-10 16:21:22 -05:00
$permalink = get_permalink ( $post_ID );
if ( ! $permalink ) {
$permalink = '' ;
}
2010-01-11 16:42:45 -05:00
$messages = array ();
2015-06-19 17:49:25 -04:00
2015-09-23 23:28:24 -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 = '' ;
$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
}
2016-06-10 00:50:33 -04:00
/* translators: Publish box date format, see https://secure.php.net/date */
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
$scheduled_date = date_i18n ( __ ( 'M j, Y @ H:i' ), strtotime ( $post -> post_date ) );
2015-09-23 23:28:24 -04:00
2010-01-11 16:42:45 -05: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.' ),
2010-01-21 16:37:43 -05: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 ,
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
);
$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.' ),
2015-09-23 23:28:24 -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 ,
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
*
* @ param array $messages Post updated messages . For defaults @ see $messages declarations above .
*/
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 = '' ;
2012-12-01 18:12:30 -05:00
if ( 'auto-draft' == $post -> post_status ) {
2017-11-30 18:11:00 -05:00
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 {
2008-08-25 17:50:11 -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' ;
2012-08-14 14:39:15 -04:00
$nonce_action = 'update-post_' . $post_ID ;
2017-11-30 18:11:00 -05:00
$form_extra .= " <input type='hidden' id='post_ID' name='post_ID' value=' " . esc_attr ( $post_ID ) . " ' /> " ;
2008-06-23 18:25:27 -04:00
2010-02-06 05:07:57 -05: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-23 19:44:59 -05:00
foreach ( _wp_post_revision_fields ( $post ) as $autosave_field => $_autosave_field ) {
2010-02-06 05:07:57 -05:00
if ( normalize_whitespace ( $autosave -> $autosave_field ) != normalize_whitespace ( $post -> $autosave_field ) ) {
2011-12-13 18:45:31 -05:00
$notice = sprintf ( __ ( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link ( $autosave -> ID ) );
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).
2013-09-24 20:18:11 -04:00
require_once ( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
2008-10-10 14:21:16 -04:00
2013-07-24 02:08:14 -04:00
$publish_callback_args = null ;
2017-11-30 18:11:00 -05:00
if ( post_type_supports ( $post_type , 'revisions' ) && 'auto-draft' != $post -> post_status ) {
2013-07-24 02:08:14 -04:00
$revisions = wp_get_post_revisions ( $post_ID );
2016-07-09 20:56:28 -04:00
// We should aim to show the revisions meta box only when there are revisions.
2013-07-24 02:08:14 -04:00
if ( count ( $revisions ) > 1 ) {
reset ( $revisions ); // Reset pointer for key()
2017-11-30 18:11:00 -05:00
$publish_callback_args = array (
'revisions_count' => count ( $revisions ),
'revision_id' => key ( $revisions ),
);
add_meta_box ( 'revisionsdiv' , __ ( 'Revisions' ), 'post_revisions_meta_box' , null , 'normal' , 'core' );
2013-07-24 02:08:14 -04:00
}
}
2012-09-21 18:52:54 -04:00
if ( 'attachment' == $post_type ) {
wp_enqueue_script ( 'image-edit' );
wp_enqueue_style ( 'imgareaselect' );
2017-11-30 18:11:00 -05:00
add_meta_box ( 'submitdiv' , __ ( 'Save' ), 'attachment_submit_meta_box' , null , 'side' , 'core' );
2012-09-21 18:52:54 -04:00
add_action ( 'edit_form_after_title' , 'edit_form_image_editor' );
2014-03-30 15:28:16 -04:00
2015-03-06 15:26:26 -05:00
if ( wp_attachment_is ( 'audio' , $post ) ) {
2014-03-30 15:28:16 -04:00
add_meta_box ( 'attachment-id3' , __ ( 'Metadata' ), 'attachment_id3_data_meta_box' , null , 'normal' , 'core' );
}
2012-09-21 18:52:54 -04:00
} else {
2013-07-24 02:08:14 -04:00
add_meta_box ( 'submitdiv' , __ ( 'Publish' ), 'post_submit_meta_box' , null , 'side' , 'core' , $publish_callback_args );
2012-09-21 18:52:54 -04:00
}
2008-02-21 22:45:19 -05:00
2017-11-30 18:11:00 -05:00
if ( current_theme_supports ( 'post-formats' ) && post_type_supports ( $post_type , 'post-formats' ) ) {
2013-05-30 17:33:46 -04:00
add_meta_box ( 'formatdiv' , _x ( 'Format' , 'post format' ), 'post_format_meta_box' , null , 'side' , 'core' );
2017-11-30 18:11:00 -05:00
}
2013-05-30 17:33:46 -04:00
2010-04-01 21:23:58 -04:00
// all taxonomies
2012-09-21 18:52:54 -04:00
foreach ( get_object_taxonomies ( $post ) as $tax_name ) {
2013-09-23 13:12:10 -04:00
$taxonomy = get_taxonomy ( $tax_name );
2017-11-30 18:11:00 -05:00
if ( ! $taxonomy -> show_ui || false === $taxonomy -> meta_box_cb ) {
2010-04-01 21:23:58 -04:00
continue ;
2017-11-30 18:11:00 -05:00
}
2010-04-01 21:23:58 -04:00
2010-05-13 20:34:04 -04:00
$label = $taxonomy -> labels -> name ;
2008-12-18 14:12:26 -05:00
2017-11-30 18:11:00 -05:00
if ( ! is_taxonomy_hierarchical ( $tax_name ) ) {
2013-09-23 13:12:10 -04:00
$tax_meta_box_id = 'tagsdiv-' . $tax_name ;
2017-11-30 18:11:00 -05:00
} else {
2013-09-23 13:12:10 -04:00
$tax_meta_box_id = $tax_name . 'div' ;
2017-11-30 18:11:00 -05:00
}
2013-09-23 13:12:10 -04:00
2013-10-27 16:36:09 -04:00
add_meta_box ( $tax_meta_box_id , $label , $taxonomy -> meta_box_cb , null , 'side' , 'core' , array ( 'taxonomy' => $tax_name ) );
2009-03-17 22:43:45 -04:00
}
2008-01-13 20:14:57 -05:00
2016-11-08 17:41:30 -05:00
if ( post_type_supports ( $post_type , 'page-attributes' ) || count ( get_page_templates ( $post ) ) > 0 ) {
Posts, Post Types: Add support for post type templates.
WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages.
While this feature is very helpful, it has always been limited to the 'page' post type and not was not available to other post types.
By opening up the page template functionality to all post types, we continue to improve the template hierarchy's flexibility.
In addition to the `Template Name` file header, the post types supported by a template can be specified using `Template Post Type: post, foo, bar`.
When at least one template exists for a post type, the 'Post Attributes' meta box will be displayed in the back end, without the need to add post type support for `'page-attributes'`. 'Post Attributes' can be customized per post type using the `'attributes'` label when registering a post type.
Props johnbillion, Mte90, dipesh.kakadiya, swissspidy.
Fixes #18375.
Built from https://develop.svn.wordpress.org/trunk@38951
git-svn-id: http://core.svn.wordpress.org/trunk@38894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 04:07:30 -04:00
add_meta_box ( 'pageparentdiv' , $post_type_object -> labels -> attributes , 'page_attributes_meta_box' , null , 'side' , 'core' );
}
2010-01-11 16:42:45 -05:00
2017-11-30 18:11:00 -05:00
if ( $thumbnail_support && current_user_can ( 'upload_files' ) ) {
add_meta_box ( 'postimagediv' , esc_html ( $post_type_object -> labels -> featured_image ), 'post_thumbnail_meta_box' , null , 'side' , 'low' );
}
2010-01-11 16:42:45 -05:00
2017-11-30 18:11:00 -05:00
if ( post_type_supports ( $post_type , 'excerpt' ) ) {
add_meta_box ( 'postexcerpt' , __ ( 'Excerpt' ), 'post_excerpt_meta_box' , null , 'normal' , 'core' );
}
2010-01-11 16:42:45 -05:00
2017-11-30 18:11:00 -05:00
if ( post_type_supports ( $post_type , 'trackbacks' ) ) {
add_meta_box ( 'trackbacksdiv' , __ ( 'Send Trackbacks' ), 'post_trackback_meta_box' , null , 'normal' , 'core' );
}
2010-01-11 16:42:45 -05:00
2017-11-30 18:11:00 -05:00
if ( post_type_supports ( $post_type , 'custom-fields' ) ) {
add_meta_box ( 'postcustom' , __ ( 'Custom Fields' ), 'post_custom_meta_box' , null , 'normal' , 'core' );
}
2010-01-11 16:42:45 -05:00
2013-10-16 18:59:09 -04:00
/**
* Fires in the middle of built - in meta box registration .
*
* @ since 2.1 . 0
* @ deprecated 3.7 . 0 Use 'add_meta_boxes' instead .
*
* @ param WP_Post $post Post object .
*/
do_action ( 'dbx_post_advanced' , $post );
2015-09-23 15:49:26 -04:00
// Allow the Discussion meta box to show up if the post type supports comments,
// or if comments or pings are open.
if ( comments_open ( $post ) || pings_open ( $post ) || post_type_supports ( $post_type , 'comments' ) ) {
add_meta_box ( 'commentstatusdiv' , __ ( 'Discussion' ), 'post_comment_status_meta_box' , null , 'normal' , 'core' );
}
2009-02-01 22:41:19 -05:00
2015-09-24 16:02:24 -04:00
$stati = get_post_stati ( array ( 'public' => true ) );
if ( empty ( $stati ) ) {
$stati = array ( 'publish' );
}
$stati [] = 'private' ;
if ( in_array ( get_post_status ( $post ), $stati ) ) {
2015-09-23 15:49:26 -04:00
// If the post type support comments, or the post has comments, allow the
// Comments meta box.
if ( comments_open ( $post ) || pings_open ( $post ) || $post -> comment_count > 0 || post_type_supports ( $post_type , 'comments' ) ) {
add_meta_box ( 'commentsdiv' , __ ( 'Comments' ), 'post_comment_meta_box' , null , 'normal' , 'core' );
}
}
2008-01-03 03:03:29 -05:00
2017-11-30 18:11:00 -05:00
if ( ! ( 'pending' == get_post_status ( $post ) && ! current_user_can ( $post_type_object -> cap -> publish_posts ) ) ) {
add_meta_box ( 'slugdiv' , __ ( 'Slug' ), 'post_slug_meta_box' , null , 'normal' , 'core' );
}
2008-05-14 04:22:01 -04:00
2016-12-07 17:09:42 -05:00
if ( post_type_supports ( $post_type , 'author' ) && current_user_can ( $post_type_object -> cap -> edit_others_posts ) ) {
add_meta_box ( 'authordiv' , __ ( 'Author' ), 'post_author_meta_box' , null , 'normal' , 'core' );
2010-03-15 17:16:41 -04:00
}
2008-01-03 03:03:29 -05:00
2013-10-16 18:59:09 -04:00
/**
* Fires after all built - in meta boxes have been added .
*
* @ since 3.0 . 0
*
* @ param string $post_type Post type .
* @ param WP_Post $post Post object .
*/
do_action ( 'add_meta_boxes' , $post_type , $post );
2010-02-03 13:54:42 -05:00
2013-10-16 18:59:09 -04:00
/**
* Fires after all built - in meta boxes have been added , contextually for the given post type .
*
2014-11-30 06:42:24 -05:00
* The dynamic portion of the hook , `$post_type` , refers to the post type of the post .
2013-10-16 18:59:09 -04:00
*
* @ since 3.0 . 0
*
* @ param WP_Post $post Post object .
*/
2016-08-22 14:25:31 -04:00
do_action ( " add_meta_boxes_ { $post_type } " , $post );
2013-10-16 18:59:09 -04:00
/**
* Fires after meta boxes have been added .
*
* Fires once for each of the default meta box contexts : normal , advanced , and side .
*
* @ since 3.0 . 0
*
* @ param string $post_type Post type of the post .
* @ param string $context string Meta box context .
* @ param WP_Post $post Post object .
*/
do_action ( 'do_meta_boxes' , $post_type , 'normal' , $post );
2013-10-24 18:59:20 -04:00
/** This action is documented in wp-admin/edit-form-advanced.php */
2013-10-16 18:59:09 -04:00
do_action ( 'do_meta_boxes' , $post_type , 'advanced' , $post );
2013-10-24 18:59:20 -04:00
/** This action is documented in wp-admin/edit-form-advanced.php */
2013-10-16 18:59:09 -04:00
do_action ( 'do_meta_boxes' , $post_type , 'side' , $post );
2008-11-11 17:40:16 -05:00
2017-11-30 18:11:00 -05:00
add_screen_option (
'layout_columns' , array (
'max' => 2 ,
'default' => 2 ,
)
);
2011-10-02 02:59:36 -04:00
2010-05-25 23:36:04 -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>' ;
2014-12-02 00:15:23 -05:00
$title_and_editor .= '<p>' . __ ( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>' ;
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>' ;
2014-04-07 21:39:14 -04: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 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 (
2017-11-30 18:11:00 -05:00
'<p>' . sprintf ( __ ( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ), 'tools.php' ) . '</p>' .
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
'<p>' . __ ( '<a href="https://codex.wordpress.org/Posts_Add_New_Screen">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
2010-05-25 23:36:04 -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>' .
'<p>' . __ ( '<a href="https://codex.wordpress.org/Pages_Add_New_Screen">Documentation on Adding New Pages</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages">Documentation on Editing Pages</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
2010-05-25 23:36:04 -04:00
);
2012-09-24 09:13:09 -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' =>
'<p>' . __ ( 'This screen allows you to edit four fields for metadata in a file within the media library.' ) . '</p>' .
'<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 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>' .
'<p>' . __ ( '<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/">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
2012-11-22 04:00:39 -05: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>' ;
2015-04-12 17:29:32 -04: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. Please refer to the Codex to <a href="https://codex.wordpress.org/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
}
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' ) ) {
2015-08-19 00:53:25 -04: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. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</li>' ;
2012-11-22 04:00:39 -05:00
}
if ( current_theme_supports ( 'post-thumbnails' ) && post_type_supports ( 'post' , 'thumbnail' ) ) {
2015-05-31 12:54:27 -04:00
/* translators: %s: Featured Image */
2015-08-19 00:53:25 -04:00
$publish_box .= '<li>' . sprintf ( __ ( '<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html ( $post_type_object -> labels -> featured_image ) ) . '</li>' ;
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 ,
)
);
2012-11-22 04:00:39 -05: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
}
2013-09-24 20:18:11 -04: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 " >
2008-11-05 14:17:22 -05:00
< ? php if ( $notice ) : ?>
2017-11-30 18:11:00 -05:00
< div id = " notice " class = " notice notice-warning " >< p id = " has-newer-autosave " >< ? php echo $notice ; ?> </p></div>
2008-11-05 14:17:22 -05:00
< ? php endif ; ?>
2009-10-10 20:37:26 -04:00
< ? php if ( $message ) : ?>
2015-04-01 18:06:28 -04:00
< div id = " message " class = " updated notice notice-success is-dismissible " >< p >< ? php echo $message ; ?> </p></div>
2008-11-05 14:17:22 -05:00
< ? php endif ; ?>
2013-04-02 18:51:09 -04:00
< div id = " lost-connection-notice " class = " error hidden " >
2013-07-18 17:33:59 -04: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-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 ) ); ?> " />
2009-05-04 22:14:25 -04:00
< ? php
2011-09-27 16:52:07 -04:00
}
2017-11-30 18:11:00 -05:00
if ( 'draft' != get_post_status ( $post ) ) {
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
2012-03-23 17:41:00 -04:00
< div id = " poststuff " >
2012-04-24 16:46:04 -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
*
* @ param string $text Placeholder text . Default 'Enter title here' .
* @ param WP_Post $post Post object .
*/
2014-12-06 16:32:24 -05:00
$title_placeholder = apply_filters ( 'enter_title_here' , __ ( 'Enter title here' ), $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 >
2014-10-26 17:49:18 -04:00
< ? php
/**
2014-11-28 03:52:23 -05:00
* Fires before the permalink field in the edit form .
2014-10-26 17:49:18 -04:00
*
* @ 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 " >
2009-05-04 22:14:25 -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
if ( $viewable ) :
2017-11-30 18:11:00 -05:00
$sample_permalink_html = $post_type_object -> public ? get_sample_permalink_html ( $post -> ID ) : '' ;
2015-01-10 16:21:22 -05:00
2017-11-30 18:11:00 -05: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
2017-11-30 18:11:00 -05: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>' ;
}
2015-09-25 15:54:25 -04:00
}
2010-03-09 14:36:38 -05:00
2017-11-30 18:11:00 -05: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 00:08:46 -04:00
< div id = " edit-slug-box " class = " hide-if-no-js " >
2010-03-15 17:16:41 -04:00
< ? php
2017-11-30 18:11:00 -05:00
if ( $has_sample_permalink ) {
echo $sample_permalink_html ;
}
2010-03-15 17:16:41 -04:00
?>
2008-08-20 17:42:31 -04:00
</ div >
2017-11-30 18:11:00 -05: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 ;
2010-03-15 17:16:41 -04:00
?>
2008-08-20 17:42:31 -04:00
</ div >
2010-04-18 05:23:03 -04:00
< ? php
wp_nonce_field ( 'samplepermalink' , 'samplepermalinknonce' , false );
?>
2012-09-21 18:52:54 -04:00
</ div ><!-- / titlediv -->
< ? php
}
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' ;
}
2012-09-21 18:52:54 -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
2017-11-30 18:11:00 -05: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 >
2015-09-17 22:32:26 -04:00
< td id = " wp-word-count " class = " hide-if-no-js " >< ? php printf ( __ ( '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 >
2008-08-20 17:42:31 -04:00
< ? php
2017-11-30 18:11:00 -05:00
if ( 'auto-draft' != $post -> post_status ) {
echo '<span id="last-edit">' ;
if ( $last_user = get_userdata ( get_post_meta ( $post_ID , '_edit_last' , true ) ) ) {
/* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */
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 {
/* translators: 1: Post edited date, 2: Post edited time */
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>' ;
}
?>
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 >
2017-11-30 18:11:00 -05:00
< ? php
}
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
2013-10-16 18:59:09 -04: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-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 >
< div id = " postbox-container-2 " class = " postbox-container " >
< ? 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
2013-10-16 18:59:09 -04:00
if ( 'page' == $post_type ) {
/**
* 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 ; ?>