wp/wp-admin/edit-form-advanced.php
author ymh <ymh.work@gmail.com>
Wed, 06 Nov 2013 03:21:17 +0000
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
permissions -rw-r--r--
first import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Post advanced form for inclusion in the administration panels.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @subpackage Administration
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
// don't load directly
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
if ( !defined('ABSPATH') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
	die('-1');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
wp_enqueue_script('post');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
if ( wp_is_mobile() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
	wp_enqueue_script( 'jquery-touch-punch' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 * Post ID global
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 * @name $post_ID
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 * @var int
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
$post_ID = isset($post_ID) ? (int) $post_ID : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
$user_ID = isset($user_ID) ? (int) $user_ID : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
$action = isset($action) ? $action : '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	add_thickbox();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
	wp_enqueue_media( array( 'post' => $post_ID ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
// Add the local autosave notice HTML
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
add_action( 'admin_footer', '_local_storage_notice' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
 * @todo Document the $messages array(s).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
$messages = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
$messages['post'] = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
	 0 => '', // Unused. Messages start at index 1.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
	 1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
	 2 => __('Custom field updated.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
	 3 => __('Custom field deleted.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
	 4 => __('Post updated.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
	/* translators: %s: date and time of the revision */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
	 5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
	 6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
	 7 => __('Post saved.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
	 8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
	 9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
		// translators: Publish box date format, see http://php.net/date
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
		date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
	10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
$messages['page'] = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
	 0 => '', // Unused. Messages start at index 1.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
	 1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
	 2 => __('Custom field updated.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
	 3 => __('Custom field deleted.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
	 4 => __('Page updated.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
	 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
	 6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
	 7 => __('Page saved.'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
	 8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
	 9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
	10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
 * Filter the post updated messages.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
 * @param array $messages Post updated messages. For defaults @see $messages declarations above.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
$messages = apply_filters( 'post_updated_messages', $messages );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
$message = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
if ( isset($_GET['message']) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
	$_GET['message'] = absint( $_GET['message'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	if ( isset($messages[$post_type][$_GET['message']]) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
		$message = $messages[$post_type][$_GET['message']];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
	elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
		$message = $messages['post'][$_GET['message']];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
$notice = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
$form_extra = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
if ( 'auto-draft' == $post->post_status ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
	if ( 'edit' == $action )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
		$post->post_title = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
	$autosave = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
	$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
	$autosave = wp_get_post_autosave( $post_ID );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
$form_action = 'editpost';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
$nonce_action = 'update-post_' . $post_ID;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
// Detect if there exists an autosave newer than the post and if that autosave is different than the post
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
	foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
		if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
			$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 ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
			break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
	// If this autosave isn't different from the current post, begone.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
	if ( ! $notice )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
		wp_delete_post_revision( $autosave->ID );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
	unset($autosave_field, $_autosave_field);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
$post_type_object = get_post_type_object($post_type);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
$publish_callback_args = null;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
	$revisions = wp_get_post_revisions( $post_ID );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
	// We should aim to show the revisions metabox only when there are revisions.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
	if ( count( $revisions ) > 1 ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
		reset( $revisions ); // Reset pointer for key()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
		$publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
		add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
if ( 'attachment' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
	wp_enqueue_script( 'image-edit' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
	wp_enqueue_style( 'imgareaselect' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
	add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
	add_action( 'edit_form_after_title', 'edit_form_image_editor' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
	add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
	add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
// all taxonomies
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
foreach ( get_object_taxonomies( $post ) as $tax_name ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
	$taxonomy = get_taxonomy( $tax_name );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
	if ( ! $taxonomy->show_ui )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
		continue;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
	$label = $taxonomy->labels->name;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
	if ( ! is_taxonomy_hierarchical( $tax_name ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
		$tax_meta_box_id = 'tagsdiv-' . $tax_name;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
	else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
		$tax_meta_box_id = $tax_name . 'div';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
	add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
if ( post_type_supports($post_type, 'page-attributes') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
	add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
$audio_post_support = $video_post_support = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
$theme_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
if ( 'attachment' === $post_type && ! empty( $post->post_mime_type ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	$audio_post_support = 0 === strpos( $post->post_mime_type, 'audio/' ) && current_theme_supports( 'post-thumbnails', 'attachment:audio' ) && post_type_supports( 'attachment:audio', 'thumbnail' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
	$video_post_support = 0 === strpos( $post->post_mime_type, 'video/' ) && current_theme_supports( 'post-thumbnails', 'attachment:video' ) && post_type_supports( 'attachment:video', 'thumbnail' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
if ( $theme_support || $audio_post_support || $video_post_support )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
	add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
if ( post_type_supports($post_type, 'excerpt') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
	add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
if ( post_type_supports($post_type, 'trackbacks') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
	add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
if ( post_type_supports($post_type, 'custom-fields') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
	add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
 * Fires in the middle of built-in meta box registration.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
 * @deprecated 3.7.0 Use 'add_meta_boxes' instead.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
do_action( 'dbx_post_advanced', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
if ( post_type_supports($post_type, 'comments') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
	add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
	add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
if ( post_type_supports($post_type, 'author') ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
	if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
		add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
 * Fires after all built-in meta boxes have been added.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
 * @param string  $post_type Post type.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
 * @param WP_Post $post      Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
do_action( 'add_meta_boxes', $post_type, $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
 * Fires after all built-in meta boxes have been added, contextually for the given post type.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
 * The dynamic portion of the hook, $post_type, refers to the post type of the post.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
do_action( 'add_meta_boxes_' . $post_type, $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
 * Fires after meta boxes have been added.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
 * Fires once for each of the default meta box contexts: normal, advanced, and side.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
 * @param string  $post_type Post type of the post.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
 * @param string  $context   string  Meta box context.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
 * @param WP_Post $post      Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
do_action( 'do_meta_boxes', $post_type, 'normal', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
/** This action is documented in wp-admin/edit-form-advanced.php */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
/** This action is documented in wp-admin/edit-form-advanced.php */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
do_action( 'do_meta_boxes', $post_type, 'side', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
if ( 'post' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
	$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>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
		'id'      => 'customize-display',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
		'title'   => __('Customizing This Display'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
		'content' => $customize_display,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
	$title_and_editor  = '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
	$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. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically. You can insert media files by clicking the icons above the post editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in Text mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
		'id'      => 'title-post-editor',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
		'title'   => __('Title and Post Editor'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
		'content' => $title_and_editor,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
	get_current_screen()->set_help_sidebar(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
			'<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
			'<p><strong>' . __('For more information:') . '</strong></p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
			'<p>' . __('<a href="http://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
			'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
} elseif ( 'page' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
	$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 &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
		'<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>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
		'id'      => 'about-pages',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
		'title'   => __('About Pages'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
		'content' => $about_pages,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
	get_current_screen()->set_help_sidebar(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
			'<p><strong>' . __('For more information:') . '</strong></p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
			'<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
			'<p>' . __('<a href="http://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
			'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
} elseif ( 'attachment' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
		'id'      => 'overview',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
		'title'   => __('Overview'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
		'content' =>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
			'<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
			'<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>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
			'<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>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
			'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
	get_current_screen()->set_help_sidebar(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
	'<p><strong>' . __('For more information:') . '</strong></p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
	'<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   304
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
if ( 'post' == $post_type || 'page' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
	$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 &#8220;Create a new gallery&#8221; button.' ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
	$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="http://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
		'id'		=> 'inserting-media',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
		'title'		=> __( 'Inserting Media' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
		'content' 	=> $inserting_media,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
if ( 'post' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
	$publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
	$publish_box .= '<ul><li>' . __('<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). 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.') . '</li>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
	if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
		$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="http://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>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
	if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
		$publish_box .= '<li>' . __('<strong>Featured Image</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 featured image as a post thumbnail on the home page, a custom header, etc.') . '</li>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
	$publish_box .= '</ul>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
		'id'      => 'publish-box',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
		'title'   => __('Publish Settings'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
		'content' => $publish_box,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
	$discussion_settings  = '<p>' . __('<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
	$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>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
		'id'      => 'discussion-settings',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
		'title'   => __('Discussion Settings'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
		'content' => $discussion_settings,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
} elseif ( 'page' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
	$page_attributes = '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
		'<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&#8217;ll see them in this dropdown menu.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   349
		'<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>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   350
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
		'id' => 'page-attributes',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
		'title' => __('Page Attributes'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
		'content' => $page_attributes,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   356
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   357
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   358
require_once( ABSPATH . 'wp-admin/admin-header.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   359
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   361
<div class="wrap">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   362
<?php screen_icon(); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
<h2><?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   364
echo esc_html( $title );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   365
if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   366
	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
?></h2>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   368
<?php if ( $notice ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
<div id="notice" class="error"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   370
<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
<?php if ( $message ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
<div id="message" class="updated"><p><?php echo $message; ?></p></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   373
<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   374
<div id="lost-connection-notice" class="error hidden">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   375
	<p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.' ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   376
	<span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   377
	</p>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   378
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   380
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   381
 * Fires inside the post editor <form> tag.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   382
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   383
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   384
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   385
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   388
<form name="post" action="post.php" method="post" id="post"<?php do_action( 'post_edit_form_tag', $post ); ?>>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   389
<?php wp_nonce_field($nonce_action); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   390
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   391
<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   392
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   393
<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   394
<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(wp_get_referer()); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
<?php if ( ! empty( $active_post_lock ) ) { ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   401
if ( 'draft' != get_post_status( $post ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   402
	wp_original_referer_field(true, 'previous');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   403
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   404
echo $form_extra;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   405
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   406
wp_nonce_field( 'autosave', 'autosavenonce', false );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   407
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   408
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   409
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   411
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
 * Fires at the beginning of the edit form.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   415
 * At this point, the required hidden fields and nonces have already been output.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   416
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   417
 * @since 3.7.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   419
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   421
do_action( 'edit_form_top', $post ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   422
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   423
<div id="poststuff">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   424
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   425
<div id="post-body-content">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   426
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   427
<?php if ( post_type_supports($post_type, 'title') ) { ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   428
<div id="titlediv">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   429
<div id="titlewrap">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   430
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   431
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   432
	 * Filter the title field placeholder text.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   434
	 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   435
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   436
	 * @param string  $text Placeholder text. Default 'Enter title here'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   437
	 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   438
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   439
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   440
	<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   441
	<input type="text" name="post_title" size="30" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   442
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   443
<div class="inside">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   444
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   445
$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   446
$shortlink = wp_get_shortlink($post->ID, 'post');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   447
$permalink = get_permalink( $post->ID );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   448
if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   449
    $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   450
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   451
if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   452
	$has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   453
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
	<div id="edit-slug-box" class="hide-if-no-js">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   455
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   456
		if ( $has_sample_permalink )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   457
			echo $sample_permalink_html;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   459
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   460
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   461
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   462
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   463
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   464
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   465
wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   466
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   467
</div><!-- /titlediv -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   468
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   469
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   470
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   471
 * Fires after the title field.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   472
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   473
 * @since 3.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   474
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   475
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   476
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   477
do_action( 'edit_form_after_title', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   478
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   479
if ( post_type_supports($post_type, 'editor') ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   480
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   481
<div id="postdivrich" class="postarea edit-form-section">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   482
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   483
<?php wp_editor( $post->post_content, 'content', array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   484
	'dfw' => true,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   485
	'tabfocus_elements' => 'insert-media-button,save-post',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   486
	'editor_height' => 360,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   487
) ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   488
<table id="post-status-info" cellspacing="0"><tbody><tr>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   489
	<td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   490
	<td class="autosave-info">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   491
	<span class="autosave-message">&nbsp;</span>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   492
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   493
	if ( 'auto-draft' != $post->post_status ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   494
		echo '<span id="last-edit">';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   495
		if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   496
			printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   497
		} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   498
			printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   499
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   500
		echo '</span>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   501
	} ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   502
	</td>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   503
</tr></tbody></table>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   504
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   505
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
<?php }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   507
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   508
 * Fires after the content editor.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   509
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
 * @since 3.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   511
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   512
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   513
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   514
do_action( 'edit_form_after_editor', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   515
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   516
</div><!-- /post-body-content -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   517
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   518
<div id="postbox-container-1" class="postbox-container">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   519
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   520
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   521
if ( 'page' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   522
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   523
	 * Fires before meta boxes with 'side' context are output for the 'page' post type.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   524
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   525
	 * The submitpage box is a meta box with 'side' context, so this hook fires just before it is output.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   526
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   527
	 * @since 2.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   528
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   529
	 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   530
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   531
	do_action( 'submitpage_box', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   532
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   533
else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   534
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   535
	 * Fires before meta boxes with 'side' context are output for all post types other than 'page'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   536
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   537
	 * The submitpost box is a meta box with 'side' context, so this hook fires just before it is output.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   538
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   539
	 * @since 2.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   540
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   541
	 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   542
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   543
	do_action( 'submitpost_box', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   544
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   545
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   546
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   547
do_meta_boxes($post_type, 'side', $post);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   548
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   549
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   550
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   551
<div id="postbox-container-2" class="postbox-container">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   552
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   553
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   554
do_meta_boxes(null, 'normal', $post);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   555
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   556
if ( 'page' == $post_type ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   557
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   558
	 * Fires after 'normal' context meta boxes have been output for the 'page' post type.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   559
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   560
	 * @since 1.5.2
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   561
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   562
	 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   563
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   564
	do_action( 'edit_page_form', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   565
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   566
else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   567
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   568
	 * Fires after 'normal' context meta boxes have been output for all post types other than 'page'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   569
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   570
	 * @since 1.5.2
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   571
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   572
	 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   573
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   574
	do_action( 'edit_form_advanced', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   575
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   576
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   577
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   578
do_meta_boxes(null, 'advanced', $post);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   579
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   580
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   581
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   582
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   583
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   584
 * Fires after all meta box sections have been output, before the closing #post-body div.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   585
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   586
 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   587
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   588
 * @param WP_Post $post Post object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   589
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   590
do_action( 'dbx_post_sidebar', $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   591
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   592
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   593
</div><!-- /post-body -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   594
<br class="clear" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   595
</div><!-- /poststuff -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   596
</form>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   597
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   598
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   599
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   600
if ( post_type_supports( $post_type, 'comments' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   601
	wp_comment_reply();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   602
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   603
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   604
<?php if ( post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   605
<script type="text/javascript">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   606
try{document.post.title.focus();}catch(e){}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   607
</script>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   608
<?php endif; ?>