WordPress.org

Make WordPress Core

Ticket #16478: 16478-better.diff

File 16478-better.diff, 4.1 KB (added by solarissmoke, 3 years ago)
  • wp-admin/includes/post.php

     
    11221122 
    11231123        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); 
    11241124 
    1125         if ( 'publish' == $post->post_status ) { 
    1126                 $ptype = get_post_type_object($post->post_type); 
    1127                 $view_post = $ptype->labels->view_item; 
    1128                 $title = __('Click to edit this part of the permalink'); 
    1129         } else { 
    1130                 $title = __('Temporary permalink. Click to edit this part.'); 
    1131         } 
    1132  
     1125        $title = ( 'publish' == $post->post_status ) ? __('Click to edit this part of the permalink') : __('Temporary permalink. Click to edit this part.'); 
     1126         
    11331127        if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { 
    11341128                $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; 
    11351129                if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) 
    11361130                        $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; 
    1137                 if ( isset($view_post) ) 
    1138                         $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n"; 
    11391131 
    11401132                $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); 
    11411133 
     
    11581150 
    11591151        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; 
    11601152        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); 
    1161         $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); 
    11621153        $return =  '<strong>' . __('Permalink:') . "</strong>\n"; 
    11631154        $return .= '<span id="sample-permalink">' . $display_link . "</span>\n"; 
    11641155        $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages. 
    11651156        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n"; 
    11661157        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n"; 
    1167         if ( isset($view_post) ) 
    1168                 $return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n"; 
    11691158 
    11701159        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); 
    11711160 
  • wp-admin/js/post.dev.js

     
    554554                                        new_title: $('#title').val(), 
    555555                                        samplepermalinknonce: $('#samplepermalinknonce').val() 
    556556                                }, function(data) { 
    557                                         $('#edit-slug-box').html(data); 
     557                                        $('#sample-permalink-wrap').html(data); 
    558558                                        b.html(revert_b); 
    559559                                        real_slug.attr('value', new_slug); 
    560560                                        makeSlugeditClickable(); 
  • wp-admin/edit-form-advanced.php

     
    248248</div> 
    249249<div class="inside"> 
    250250<?php 
    251 $sample_permalink_html = ! empty( $post_type_object->publicly_queryable ) ? get_sample_permalink_html($post->ID) : ''; 
     251$sample_permalink_html = ! empty( $post_type_object->publicly_queryable ) ? '<span id="sample-permalink-wrap">' . get_sample_permalink_html($post->ID) . '</span>' : ''; 
     252$sample_permalink_html .= "<span id='view-post-btn'><a href='" . get_permalink( $post_ID ). "' class='button' target='_blank'>{$post_type_object->labels->view_item}</a></span>\n"; 
     253 
    252254$shortlink = wp_get_shortlink($post->ID, 'post'); 
    253255if ( !empty($shortlink) ) 
    254256    $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';