2 if ( isset($_GET['message']) )
3 $_GET['message'] = absint( $_GET['message'] );
4 $messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) );
5 $messages[2] = __('Custom field updated.');
6 $messages[3] = __('Custom field deleted.');
7 $messages[4] = __('Page updated.');
9 <?php if (isset($_GET['message'])) : ?>
10 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
13 if (!isset($post_ID) || 0 == $post_ID) {
14 $form_action = 'post';
15 $nonce_action = 'add-page';
16 $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
17 $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
19 $post_ID = (int) $post_ID;
20 $form_action = 'editpost';
21 $nonce_action = 'update-page_' . $post_ID;
22 $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
25 $temp_ID = (int) $temp_ID;
26 $user_ID = (int) $user_ID;
28 $sendto = clean_url(stripslashes(wp_get_referer()));
30 if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
34 <form name="post" action="page.php" method="post" id="post">
36 <h2><?php _e('Write Page') ?></h2>
39 wp_nonce_field($nonce_action);
41 if (isset($mode) && 'bookmarklet' == $mode)
42 echo '<input type="hidden" name="mode" value="bookmarklet" />';
44 <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
45 <input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
46 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
47 <?php echo $form_extra ?>
48 <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
49 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
50 <input name="referredby" type="hidden" id="referredby" value="<?php
51 if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
54 echo clean_url(stripslashes(wp_get_referer()));
56 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
60 <div class="submitbox" id="submitpage">
62 <div id="previewview">
63 <?php if ( 'publish' == $post->post_status ) { ?>
64 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Page'); ?></a>
65 <?php } elseif ( 'edit' == $action ) { ?>
66 <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank" tabindex="4"><?php _e('Preview this Page'); ?></a>
72 <p><strong><?php _e('Publish Status') ?></strong></p>
74 <select name='post_status' tabindex='4'>
75 <?php if ( current_user_can('publish_pages') ) : ?>
76 <option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
78 <option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
80 <?php if ( 'future' == $post->post_status ) : ?>
81 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
83 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
84 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
88 <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
91 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
92 $stamp = __('Scheduled for:<br />%1$s at %2$s');
93 } else if ( 'publish' == $post->post_status ) { // already published
94 $stamp = __('Published on:<br />%1$s at %2$s');
95 } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
96 $stamp = __('Publish immediately');
97 } else { // draft, 1 or more saves, date specified
98 $stamp = __('Publish on:<br />%1$s at %2$s');
100 $date = mysql2date(get_option('date_format'), $post->post_date);
101 $time = mysql2date(get_option('time_format'), $post->post_date);
102 } else { // draft (no saves, and thus no date specified)
103 $stamp = __('Publish immediately');
104 $date = mysql2date(get_option('date_format'), current_time('mysql'));
105 $time = mysql2date(get_option('time_format'), current_time('mysql'));
108 <p class="curtime"><?php printf($stamp, $date, $time); ?>
109 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
111 <div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
116 <input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" />
118 if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
120 <?php if ( current_user_can('publish_pages') ) : ?>
121 <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
123 <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
128 if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
129 echo "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&post=$post_ID", 'delete-page_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete page') . "</a>";
132 <?php if ($post_ID): ?>
133 <?php if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
134 $last_user = get_userdata($last_id);
135 printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
137 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));
142 <span id="autosave"></span>
145 <div class="side-info">
146 <h5><?php _e('Related') ?></h5>
149 <?php if ($post_ID): ?>
150 <li><a href="edit-pages.php?page_id=<?php echo $post_ID ?>"><?php _e('See Comments on this Page') ?></a></li>
152 <li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li>
153 <li><a href="edit-pages.php"><?php _e('Manage All Pages') ?></a></li>
154 <?php do_action('page_relatedlinks_list'); ?>
157 <?php do_action('submitpage_box'); ?>
162 <h3><?php _e('Title') ?></h3>
164 <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
167 <?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
168 <div id="edit-slug-box">
169 <?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
170 echo $sample_permalink_html;
176 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
177 <h3><?php _e('Page') ?></h3>
178 <?php the_editor($post->post_content); ?>
179 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
180 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
181 <?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
182 <?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
185 <?php do_meta_boxes('page', 'normal', $post); ?>
187 <?php do_action('edit_page_form'); ?>
189 <h2><?php _e('Advanced Options'); ?></h2>
191 <div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>">
192 <h3><?php _e('Custom Fields') ?></h3>
194 <div id="postcustomstuff">
195 <table cellpadding="3">
197 $metadata = has_meta($post_ID);
198 list_meta($metadata);
205 <div id="ajax-response"></div>
207 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
211 <div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>">
212 <h3><?php _e('Comments & Pings') ?></h3>
214 <input name="advanced_view" type="hidden" value="1" />
215 <p><label for="comment_status" class="selectit">
216 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
217 <?php _e('Allow Comments') ?></label></p>
218 <p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
219 <p><?php _e('These settings apply to this page only. “Pings” are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
223 <div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>">
224 <h3><?php _e('Password Protect This Page') ?></h3>
226 <p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
227 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
231 <div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>">
232 <h3><?php _e('Page Slug') ?></h3>
234 <input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
238 <div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>">
239 <h3><?php _e('Page Parent') ?></h3>
241 <select name="parent_id">
242 <option value='0'><?php _e('Main Page (no parent)'); ?></option>
243 <?php parent_dropdown($post->post_parent); ?>
245 <p><?php _e('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 deeply nested you can make pages.'); ?></p>
249 <?php if ( 0 != count( get_page_templates() ) ) { ?>
250 <div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>">
251 <h3><?php _e('Page Template') ?></h3>
253 <select name="page_template">
254 <option value='default'><?php _e('Default Template'); ?></option>
255 <?php page_template_dropdown($post->page_template); ?>
257 <p><?php _e('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 above.'); ?></p>
262 <div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>">
263 <h3><?php _e('Page Order') ?></h3>
265 <p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
266 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it’ll be better in future releases.)'); ?></p>
271 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
272 if ( $post->post_author && !in_array($post->post_author, $authors) )
273 $authors[] = $post->post_author;
274 if ( $authors && count( $authors ) > 1 ) :
276 <div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>">
277 <h3><?php _e('Page Author'); ?></h3>
279 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
284 <?php do_meta_boxes('page', 'advanced', $post); ?>
293 <script type="text/javascript">
294 try{document.post.title.focus();}catch(e){}