3 // -- Post related Meta Boxes
6 * Display post submit form fields.
12 function post_submit_meta_box($post) {
15 $post_type = $post->post_type;
16 $can_publish = current_user_can("publish_${post_type}s");
18 <div class="submitbox" id="submitpost">
20 <div id="minor-publishing">
22 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
23 <div style="display:none;">
24 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />
27 <div id="minor-publishing-actions">
28 <div id="save-action">
29 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
30 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />
31 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
32 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" />
36 <div id="preview-action">
38 if ( 'publish' == $post->post_status ) {
39 $preview_link = esc_url(get_permalink($post->ID));
40 $preview_button = __('Preview Changes');
42 $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))));
43 $preview_button = __('Preview');
46 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a>
47 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
50 <div class="clear"></div>
51 </div><?php // /minor-publishing-actions ?>
53 <div id="misc-publishing-actions">
55 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
56 <span id="post-status-display">
58 switch ( $post->post_status ) {
60 _e('Privately Published');
77 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
78 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
80 <div id="post-status-select" class="hide-if-js">
81 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" />
82 <select name='post_status' id='post_status' tabindex='4'>
83 <?php if ( 'publish' == $post->post_status ) : ?>
84 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
85 <?php elseif ( 'private' == $post->post_status ) : ?>
86 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
87 <?php elseif ( 'future' == $post->post_status ) : ?>
88 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
90 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
91 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
93 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
94 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
98 </div><?php // /misc-pub-section ?>
100 <div class="misc-pub-section " id="visibility">
101 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
103 if ( 'private' == $post->post_status ) {
104 $post->post_password = '';
105 $visibility = 'private';
106 $visibility_trans = __('Private');
107 } elseif ( !empty( $post->post_password ) ) {
108 $visibility = 'password';
109 $visibility_trans = __('Password protected');
110 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
111 $visibility = 'public';
112 $visibility_trans = __('Public, Sticky');
114 $visibility = 'public';
115 $visibility_trans = __('Public');
118 echo esc_html( $visibility_trans ); ?></span>
119 <?php if ( $can_publish ) { ?>
120 <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
122 <div id="post-visibility-select" class="hide-if-js">
123 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
124 <?php if ($post_type == 'post'): ?>
125 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
127 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
130 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
131 <?php if ($post_type == 'post'): ?>
132 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>
134 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
135 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" /><br /></span>
136 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
139 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
140 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>
145 </div><?php // /misc-pub-section ?>
149 // translators: Publish box date formt, see http://php.net/date
150 $datef = __( 'M j, Y @ G:i' );
151 if ( 0 != $post->ID ) {
152 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
153 $stamp = __('Scheduled for: <b>%1$s</b>');
154 } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
155 $stamp = __('Published on: <b>%1$s</b>');
156 } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
157 $stamp = __('Publish <b>immediately</b>');
158 } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
159 $stamp = __('Schedule for: <b>%1$s</b>');
160 } else { // draft, 1 or more saves, date specified
161 $stamp = __('Publish on: <b>%1$s</b>');
163 $date = date_i18n( $datef, strtotime( $post->post_date ) );
164 } else { // draft (no saves, and thus no date specified)
165 $stamp = __('Publish <b>immediately</b>');
166 $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
169 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
170 <div class="misc-pub-section curtime misc-pub-section-last">
171 <span id="timestamp">
172 <?php printf($stamp, $date); ?></span>
173 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
174 <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
175 </div><?php // /misc-pub-section ?>
178 <?php do_action('post_submitbox_misc_actions'); ?>
180 <div class="clear"></div>
183 <div id="major-publishing-actions">
184 <?php do_action('post_submitbox_start'); ?>
185 <div id="delete-action">
187 if ( current_user_can( "delete_${post_type}", $post->ID ) ) {
188 if ( !EMPTY_TRASH_DAYS ) {
189 $delete_url = wp_nonce_url( add_query_arg( array('action' => 'delete', 'post' => $post->ID) ), "delete-${post_type}_{$post->ID}" );
190 $delete_text = __('Delete Permanently');
192 $delete_url = wp_nonce_url( add_query_arg( array('action' => 'trash', 'post' => $post->ID) ), "trash-${post_type}_{$post->ID}" );
193 $delete_text = __('Move to Trash');
195 <a class="submitdelete deletion<?php if ( 'edit' != $action ) { echo " hidden"; } ?>" href="<?php echo $delete_url; ?>"><?php echo $delete_text; ?></a><?php
199 <div id="publishing-action">
200 <img src="images/wpspin_light.gif" id="ajax-loading" style="visibility:hidden;" alt="" />
202 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
203 if ( $can_publish ) :
204 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
205 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
206 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" />
208 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
209 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" />
212 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
213 <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" />
217 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
218 <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
222 <div class="clear"></div>
231 * Display post tags form fields.
235 * @param object $post
237 function post_tags_meta_box($post, $box) {
238 $tax_name = esc_attr(substr($box['id'], 8));
239 $taxonomy = get_taxonomy($tax_name);
240 $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
242 <div class="tagsdiv" id="<?php echo $tax_name; ?>">
244 <div class="nojs-tags hide-if-js">
245 <p><?php _e('Add or remove tags'); ?></p>
246 <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
248 <div class="ajaxtag hide-if-no-js">
249 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
250 <div class="taghint"><?php _e('Add new tag'); ?></div>
251 <input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
252 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
254 <p class="howto"><?php echo $helps; ?></p>
255 <div class="tagchecklist"></div>
257 <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>
263 * Display post categories form fields.
267 * @param object $post
269 function post_categories_meta_box($post) {
271 <ul id="category-tabs">
272 <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
273 <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
276 <div id="categories-pop" class="tabs-panel" style="display: none;">
277 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
278 <?php $popular_ids = wp_popular_terms_checklist('category'); ?>
282 <div id="categories-all" class="tabs-panel">
283 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
284 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
288 <?php if ( current_user_can('manage_categories') ) : ?>
289 <div id="category-adder" class="wp-hidden-children">
290 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
291 <p id="category-add" class="wp-hidden-child">
292 <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
293 <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?>
294 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
295 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
296 <span id="category-ajax-response"></span></p>
305 * Display post excerpt form fields.
309 * @param object $post
311 function post_excerpt_meta_box($post) {
313 <label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
314 <p><?php _e('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="http://codex.wordpress.org/Excerpt" target="_blank">Learn more about manual excerpts.</a>'); ?></p>
320 * Display trackback links form fields.
324 * @param object $post
326 function post_trackback_meta_box($post) {
327 $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" tabindex="7" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />';
328 if ('' != $post->pinged) {
329 $pings = '<p>'. __('Already pinged:') . '</p><ul>';
330 $already_pinged = explode("\n", trim($post->pinged));
331 foreach ($already_pinged as $pinged_url) {
332 $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
338 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
339 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress blogs they’ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
341 if ( ! empty($pings) )
347 * Display custom fields form fields.
351 * @param object $post
353 function post_custom_meta_box($post) {
355 <div id="postcustomstuff">
356 <div id="ajax-response"></div>
358 $metadata = has_meta($post->ID);
359 list_meta($metadata);
362 <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>
368 * Display comments status form fields.
372 * @param object $post
374 function post_comment_status_meta_box($post) {
376 <input name="advanced_view" type="hidden" value="1" />
377 <p class="meta-options">
378 <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /><?php _e('Allow Comments.') ?></label><br />
379 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /><?php printf( __('Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.'),_x('http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments','Url to codex article on Managing Comments')); ?></label>
386 * Display comments for post.
390 * @param object $post
392 function post_comment_meta_box($post) {
393 global $wpdb, $post_ID;
395 $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
398 echo '<p>' . __('No comments yet.') . '</p>';
402 wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
405 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
407 <th scope="col" class="column-author"><?php _e('Author') ?></th>
408 <th scope="col" class="column-comment">
409 <?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>
411 <tbody id="the-comment-list" class="list:comment"></tbody>
413 <p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /></p>
415 $hidden = get_hidden_meta_boxes('post');
416 if ( ! in_array('commentsdiv', $hidden) ) { ?>
417 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
420 wp_comment_trashnotice();
425 * Display slug form fields.
429 * @param object $post
431 function post_slug_meta_box($post) {
433 <label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $post->post_name ); ?>" />
439 * Display form field with list of authors.
443 * @param object $post
445 function post_author_meta_box($post) {
446 global $current_user, $user_ID;
447 $authors = get_editable_user_ids( $current_user->id, true, $post->post_type ); // TODO: ROLE SYSTEM
448 if ( $post->post_author && !in_array($post->post_author, $authors) )
449 $authors[] = $post->post_author;
451 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
457 * Display list of revisions.
461 * @param object $post
463 function post_revisions_meta_box($post) {
464 wp_list_post_revisions();
468 // -- Page related Meta Boxes
471 * Display page attributes form fields.
475 * @param object $post
477 function page_attributes_meta_box($post){
479 <h5><?php _e('Parent') ?></h5>
480 <label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label>
481 <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?>
482 <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>
484 if ( 0 != count( get_page_templates() ) ) { ?>
485 <h5><?php _e('Template') ?></h5>
486 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
487 <option value='default'><?php _e('Default Template'); ?></option>
488 <?php page_template_dropdown($post->page_template); ?>
490 <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>
493 <h5><?php _e('Order') ?></h5>
494 <p><label class="screen-reader-text" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
495 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in.'); ?></p>
500 // -- Link related Meta Boxes
503 * Display link create form fields.
507 * @param object $link
509 function link_submit_meta_box($link) {
511 <div class="submitbox" id="submitlink">
513 <div id="minor-publishing">
515 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
516 <div style="display:none;">
517 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />
520 <div id="minor-publishing-actions">
521 <div id="preview-action">
522 <?php if ( !empty($link->link_id) ) { ?>
523 <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>
526 <div class="clear"></div>
529 <div id="misc-publishing-actions">
530 <div class="misc-pub-section misc-pub-section-last">
531 <label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label>
537 <div id="major-publishing-actions">
538 <?php do_action('post_submitbox_start'); ?>
539 <div id="delete-action">
541 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
542 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
546 <div id="publishing-action">
547 <?php if ( !empty($link->link_id) ) { ?>
548 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" />
550 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" />
553 <div class="clear"></div>
555 <?php do_action('submitlink_box'); ?>
556 <div class="clear"></div>
563 * Display link categories form fields.
567 * @param object $link
569 function link_categories_meta_box($link) { ?>
570 <ul id="category-tabs">
571 <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
572 <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
575 <div id="categories-all" class="tabs-panel">
576 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
578 if ( isset($link->link_id) )
579 wp_link_category_checklist($link->link_id);
581 wp_link_category_checklist();
586 <div id="categories-pop" class="tabs-panel" style="display: none;">
587 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
588 <?php wp_popular_terms_checklist('link_category'); ?>
592 <div id="category-adder" class="wp-hidden-children">
593 <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
594 <p id="link-category-add" class="wp-hidden-child">
595 <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
596 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
597 <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />
598 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
599 <span id="category-ajax-response"></span>
607 * Display form fields for changing link target.
611 * @param object $link
613 function link_target_meta_box($link) { ?>
614 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
615 <p><label for="link_target_blank" class="selectit">
616 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
617 <?php _e('<code>_blank</code> - new window or tab.'); ?></label></p>
618 <p><label for="link_target_top" class="selectit">
619 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
620 <?php _e('<code>_top</code> - current window or tab, with no frames.'); ?></label></p>
621 <p><label for="link_target_none" class="selectit">
622 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
623 <?php _e('<code>_none</code> - same window or tab.'); ?></label></p>
625 <p><?php _e('Choose the target frame for your link.'); ?></p>
631 * Display checked checkboxes attribute for xfn microformat options.
635 * @param string $class
636 * @param string $value
637 * @param mixed $deprecated Not used.
639 function xfn_check($class, $value = '', $deprecated = '') {
642 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
643 $rels = preg_split('/\s+/', $link_rel);
645 if ('' != $value && in_array($value, $rels) ) {
646 echo ' checked="checked"';
650 if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
651 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
652 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
653 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
659 * Display xfn form fields.
663 * @param object $link
665 function link_xfn_meta_box($link) {
667 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
669 <th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
670 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
674 <table cellpadding="3" cellspacing="5" class="form-table">
676 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </th>
677 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </span></legend>
679 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
680 <?php _e('another web address of mine') ?></label>
684 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th>
685 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend>
686 <label for="contact">
687 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>
688 <label for="acquaintance">
689 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>
691 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>
692 <label for="friendship">
693 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
697 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>
698 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </span></legend>
700 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
701 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?></label>
705 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>
706 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </span></legend>
707 <label for="co-worker">
708 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
709 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?></label>
710 <label for="colleague">
711 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
712 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?></label>
716 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th>
717 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
718 <label for="co-resident">
719 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
720 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label>
721 <label for="neighbor">
722 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
723 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label>
724 <label for="geographical">
725 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
726 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
730 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th>
731 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
733 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
734 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label>
736 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
737 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label>
739 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
740 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label>
741 <label for="sibling">
742 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
743 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label>
745 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
746 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label>
748 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
749 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
753 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </th>
754 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>
756 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
757 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?></label>
759 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
760 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?></label>
762 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
763 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?></label>
764 <label for="romantic">
765 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
766 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?></label>
773 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
779 * Display advanced link options form fields.
783 * @param object $link
785 function link_advanced_meta_box($link) {
787 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
788 <tr class="form-field">
789 <th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
790 <td><input type="text" name="link_image" class="code" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" style="width: 95%" /></td>
792 <tr class="form-field">
793 <th valign="top" scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
794 <td><input name="link_rss" class="code" type="text" id="rss_uri" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" size="50" style="width: 95%" /></td>
796 <tr class="form-field">
797 <th valign="top" scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
798 <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); ?></textarea></td>
800 <tr class="form-field">
801 <th valign="top" scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
802 <td><select name="link_rating" id="link_rating" size="1">
804 for ($r = 0; $r <= 10; $r++) {
805 echo(' <option value="'. esc_attr($r) .'" ');
806 if ( isset($link->link_rating) && $link->link_rating == $r)
807 echo 'selected="selected"';
808 echo('>'.$r.'</option>');
810 ?></select> <?php _e('(Leave at 0 for no rating.)') ?>
818 * Display post thumbnail meta box.
822 function post_thumbnail_meta_box() {
824 $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
825 echo _wp_post_thumbnail_html( $thumbnail_id );