Ticket #18523: 18523.4.diff
File 18523.4.diff, 3.2 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-form-advanced.php
304 304 } 305 305 } 306 306 307 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )308 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');309 310 307 if ( post_type_supports($post_type, 'author') ) { 311 308 if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) 312 309 add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); … … 567 564 ?> 568 565 <div class="inside"> 569 566 <?php 570 if ( $viewable ) :571 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';567 if ( $viewable ) { 568 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; 572 569 573 // As of 4.4, the Get Shortlink button is hidden by default.574 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {575 $shortlink = wp_get_shortlink($post->ID, 'post');570 // As of 4.4, the Get Shortlink button is hidden by default. 571 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { 572 $shortlink = wp_get_shortlink($post->ID, 'post'); 576 573 577 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) { 578 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; 574 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) { 575 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; 576 } 579 577 } 580 }581 578 582 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { 583 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; 584 ?> 585 <div id="edit-slug-box" class="hide-if-no-js"> 579 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { 580 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; 581 ?> 582 <div id="edit-slug-box" class="hide-if-no-js"> 583 <?php 584 if ( $has_sample_permalink ) 585 echo $sample_permalink_html; 586 ?> 587 </div> 586 588 <?php 587 if ( $has_sample_permalink ) 588 echo $sample_permalink_html; 589 } 590 } elseif( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { 591 $editable_slug = apply_filters( 'editable_slug', $post->post_name, $post ); 589 592 ?> 590 </div> 591 <?php 593 <label for="post_name"><?php _e( 'Slug:' ) ?></label> 594 <input name="post_name" type="text" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" /> 595 <?php 592 596 } 593 endif;594 597 ?> 595 598 </div> 596 599 <?php